<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mevlüt Can Tuna on Medium]]></title>
        <description><![CDATA[Stories by Mevlüt Can Tuna on Medium]]></description>
        <link>https://medium.com/@mevlutcantuna?source=rss-135c340004a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B67TjmMvCSevfr9KD_dQ0w.jpeg</url>
            <title>Stories by Mevlüt Can Tuna on Medium</title>
            <link>https://medium.com/@mevlutcantuna?source=rss-135c340004a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:09:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mevlutcantuna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Listing Calls Data from Multiple ServiceTitan Accounts]]></title>
            <link>https://medium.com/peaka/listing-calls-data-from-multiple-servicetitan-accounts-4738ad4c9b5f?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4738ad4c9b5f</guid>
            <category><![CDATA[servicetitan]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 12:50:18 GMT</pubDate>
            <atom:updated>2025-10-13T08:27:14.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*wzaTuKjhmnHkLiQT3rbiBQ.png" /></figure><p>As a ServiceTitan consultant, you’re constantly juggling calls data across dozens of client accounts. Whether you’re preparing monthly <a href="https://www.peaka.com/blog/consultants-servicetitan-kpi-dashboards">KPI dashboards</a>, analyzing call performance for coaching sessions, or delivering dashboard updates to multiple clients, <a href="https://www.peaka.com/blog/servicetitan-manual-data-export-costs/">manual data exports</a> from each ServiceTitan instance are eating up your billable hours.</p><p>Peaka transforms how consulting firms deliver ServiceTitan analytics. Instead of building custom dashboards for each client or wrestling with spreadsheet exports, you can instantly <a href="https://www.peaka.com/blog/manage-multiple-servicetitan-accounts">unify data from multiple ServiceTitan accounts</a> using natural language queries — no coding required.</p><p>In this guide, we’ll show you how to connect multiple client ServiceTitan accounts to Peaka and use our AI chatbot to instantly retrieve calls data for any client — turning hours of manual work into minutes of automated insights.</p><h3><strong>Setting Up Your ServiceTitan Connections</strong></h3><p>Before you can query calls data for your clients, you’ll need to connect their ServiceTitan accounts to Peaka. The process is straightforward and takes just a few minutes per client.</p><p>First, navigate to the Connections section in your Peaka workspace and select ServiceTitan from the available integrations. You’ll need API credentials from each client’s ServiceTitan admin panel — most clients can generate these quickly with your guidance.</p><p>Once connected, Peaka will automatically sync each client’s ServiceTitan data, including calls records, customer information, and call tracking data. This gives you immediate access to query calls data across your entire client portfolio from a single workspace.</p><p>For detailed step-by-step instructions, check out our comprehensive guide: <a href="https://docs.peaka.com/integrations/service-titan">Connect your ServiceTitan Account to Peaka</a></p><h3><strong>Getting Client Calls Data in 4 Simple Steps</strong></h3><p>Once your clients’ ServiceTitan data is flowing into Peaka, retrieving calls information for any client becomes incredibly straightforward. Here’s how to pull calls data from multiple client accounts:</p><h4><strong>Step 1: Write your query</strong></h4><p>Navigate to your Peaka workspace and create a new query. Select the <strong>AI|GPT</strong> section to access our natural language query interface.</p><p><em>Pro tip: New to Peaka queries? Check out our </em><a href="https://docs.peaka.com/connecting-your-data/peaka-query#what-is-a-peaka-query"><em>comprehensive guide</em></a><em> to get up to speed.</em></p><h4><strong>Step 2: Ask in natural language</strong></h4><p>Simply type your request in natural language. For example:</p><pre>List all calls from all of my ServiceTitan accounts.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uux-KCqziMg8s-1KRq0Dg.png" /></figure><h4><strong>Step 3: Select your data sources</strong></h4><p>Peaka will automatically suggest the relevant tables. For calls data, you’ll typically need:</p><ul><li><strong>Calls Table</strong>: your_service_titan_connection &gt; telecom &gt; calls</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pS8j1wWus2m3frYoFL2e-A.png" /></figure><h4><strong>Step 4: Execute and analyze</strong></h4><p>Hit run and watch Peaka generate the SQL query behind the scenes. Your results appear instantly, showing all calls from your client’s ServiceTitan account with complete details — ready to drop into your monthly KPI report or coaching session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZS2cSvd7D2Z8kmYnP3-Qw.png" /></figure><h4><strong>Conclusion: Deliver premium analytics without the overhead</strong></h4><p>As a ServiceTitan consultant, your time should be spent coaching clients and growing your practice — not wrestling with data exports and dashboard builds. With Peaka’s AI chatbot, you can deliver professional calls analytics to any client in minutes, not hours.</p><p>Whether you’re preparing monthly KPI reports, analyzing call performance trends, or building premium dashboard offerings, you now have the tools to scale your consulting practice without hiring developers or learning complex <a href="https://www.peaka.com/blog/how-to-connect-servicetitan-to-looker-studio">BI tools</a>.</p><p>Ready to transform your ServiceTitan consulting delivery? Your next client success story is just one conversation away.</p><p><a href="https://peaka.studio/signup">Sign up to Peaka</a> for free today.</p><p><a href="https://calendly.com/peaka/demo">Book a quick demo</a> and see how Peaka can help simplify ServiceTitan reporting for you and your clients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4738ad4c9b5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peaka/listing-calls-data-from-multiple-servicetitan-accounts-4738ad4c9b5f">Listing Calls Data from Multiple ServiceTitan Accounts</a> was originally published in <a href="https://medium.com/peaka">Peaka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Listing Technician Data from Multiple ServiceTitan Accounts]]></title>
            <link>https://medium.com/peaka/listing-technician-data-from-multiple-servicetitan-accounts-331053f56bf8?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/331053f56bf8</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[servicetitan]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 12:11:10 GMT</pubDate>
            <atom:updated>2025-09-03T12:59:17.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*wzaTuKjhmnHkLiQT3rbiBQ.png" /></figure><p>Managing technician data across multiple ServiceTitan accounts is a common challenge for PE firms and multi-location service businesses. Whether you’re consolidating workforce reports, analyzing technician performance across brands, or preparing operational updates, you need an efficient way to pull technician data from all your ServiceTitan instances.</p><p>Peaka offers multiple ways to access and analyze your ServiceTitan data through SQL queries, table views, or our AI chatbot. This flexibility means you can get the consolidated technician data you need from multiple accounts, regardless of your technical background.</p><p>In this guide, we’ll walk you through connecting multiple ServiceTitan accounts to Peaka and use our AI chatbot to instantly retrieve and consolidate technician data across your entire portfolio with no SQL required.</p><h3><strong>Setting Up Your ServiceTitan Connections</strong></h3><p>Before you can query technician data, you’ll need to connect your ServiceTitan account to Peaka. The process is straightforward and takes just a few minutes.</p><p>First, navigate to the Connections section in your Peaka workspace and select ServiceTitan from the available integrations. You’ll need your ServiceTitan API credentials, which you can generate from your ServiceTitan admin panel.</p><p>Once connected, Peaka will automatically sync your ServiceTitan data, including technician records, job assignments, and scheduling information. This gives you immediate access to query technician data across all your connected accounts through our platform.</p><p>For detailed step-by-step instructions, check out our comprehensive guide: <a href="https://docs.peaka.com/integrations/service-titan">Connect your ServiceTitan Account to Peaka</a></p><h3><strong>Getting Invoices Data in 4 Simple Steps</strong></h3><p>Once your ServiceTitan data is flowing into Peaka, retrieving technicians information becomes incredibly straightforward. Here’s how to pull all technicians from multiple ServiceTitan accounts:</p><h4><strong>Step 1: Start a New Query</strong></h4><p>Navigate to your Peaka workspace and create a new query. Select the <strong>AI|GPT</strong> section to access our natural language query interface.</p><p><em>Pro tip: New to Peaka queries? Check out our </em><a href="https://docs.peaka.com/connecting-your-data/peaka-query#what-is-a-peaka-query"><em>comprehensive guide</em></a><em> to get up to speed.</em></p><h4><strong>Step 2: Ask in Plain English</strong></h4><p>Simply type your request in natural language. For example:</p><pre>List all technicians from all of my ServiceTitan accounts.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lx-r8UiNYeb9H40dmrKKtQ.png" /></figure><h4><strong>Step 3: Select Your Data Sources</strong></h4><p>Peaka will automatically suggest the relevant tables. For employee job data, you’ll typically need:</p><ul><li><strong>Technicians Table</strong>: your_service_titan_connection &gt; settings &gt; technicians</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxxcEfxp9TBkCisJ1Eb4QA.png" /></figure><h4><strong>Step 4: Execute and Analyze</strong></h4><p>Hit run and watch Peaka generate the SQL query behind the scenes. Your results appear instantly, showing all technicians from your connected ServiceTitan accounts with complete details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46xTIBCC8yvqVKg1-p16xQ.png" /></figure><h4><strong>Conclusion: Convert manual chaos into organized intelligence</strong></h4><p>Managing technician data across multiple ServiceTitan accounts doesn’t have to mean juggling spreadsheets and manual exports. With Peaka’s AI chatbot, you can consolidate workforce data from your entire portfolio using natural language just ask and get instant results.</p><p>Whether you’re tracking performance metrics, planning resource allocation, or preparing executive reports, you now have the tools to make data-driven decisions across all your ServiceTitan instances. No technical expertise required, no time wasted on manual processes.</p><p>Ready to transform how you handle multi-account ServiceTitan data? Your technician insights are just one conversation away.</p><p><a href="https://peaka.studio/signup">Sign up to Peaka</a> for free today.</p><p><a href="https://calendly.com/peaka/demo">Book a quick demo</a> and see how Peaka can help simplify ServiceTitan reporting for you and your clients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=331053f56bf8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peaka/listing-technician-data-from-multiple-servicetitan-accounts-331053f56bf8">Listing Technician Data from Multiple ServiceTitan Accounts</a> was originally published in <a href="https://medium.com/peaka">Peaka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Listing All Jobs for an Employee in ServiceTitan Using Peaka]]></title>
            <link>https://medium.com/peaka/listing-all-jobs-for-an-employee-in-servicetitan-using-peaka-04d7501a9968?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/04d7501a9968</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[servicetitan]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 12:10:46 GMT</pubDate>
            <atom:updated>2025-09-03T12:58:56.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*wzaTuKjhmnHkLiQT3rbiBQ.png" /></figure><p>Managing employee performance in ServiceTitan requires quick access to job data. Whether you’re tracking technician productivity, analyzing job completion rates, or preparing performance reviews, you need an efficient way to pull all jobs assigned to specific employees.</p><p>Peaka offers multiple ways to access and analyze your ServiceTitan data — through SQL queries, table views, or our AI chatbot. This flexibility means you can get the employee job data you need, regardless of your technical background.</p><p>In this guide, we’ll walk you through connecting ServiceTitan to Peaka and use our AI chatbot to instantly retrieve all jobs for any employee in your organization — no SQL required.</p><h3><strong>Setting Up Your ServiceTitan Connection</strong></h3><p>Before you can query employee job data, you’ll need to connect your ServiceTitan account to Peaka. The process is straightforward and takes just a few minutes.</p><p>First, navigate to the Connections section in your Peaka workspace and select ServiceTitan from the available integrations. You’ll need your ServiceTitan API credentials, which you can generate from your ServiceTitan admin panel.</p><p>Once connected, Peaka will automatically sync your ServiceTitan data, including employee records, job assignments, and scheduling information. This gives you immediate access to query any employee’s job history through our platform.</p><p>For detailed step-by-step instructions, check out our comprehensive guide: <a href="https://docs.peaka.com/integrations/service-titan">Connect your ServiceTitan Account to Peaka</a></p><h3><strong>Getting Employee Job Data in 4 Simple Steps</strong></h3><p>Once your ServiceTitan data is flowing into Peaka, retrieving employee job information becomes incredibly straightforward. Here’s how to pull all jobs for any specific employee:</p><h4><strong>Step 1: Start a New Query</strong></h4><p>Navigate to your Peaka workspace and create a new query. Select the <strong>**AI|GPT**</strong> section to access our natural language query interface.</p><p><em>Pro tip: New to Peaka queries? Check out our </em><a href="https://docs.peaka.com/connecting-your-data/peaka-query#what-is-a-peaka-query"><em>comprehensive guide</em></a><em> to get up to speed.</em></p><h4><strong>Step 2: Ask in Plain English</strong></h4><p>Simply type your request in natural language. For example:</p><pre>List all jobs assigned to the employee named Can Tuna, filtered by the user who created them.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jk6SEUoBJnn2Fu4pMTlJtA.png" /></figure><h4><strong>Step 3: Select Your Data Sources</strong></h4><p>Peaka will automatically suggest the relevant tables. For employee job data, you’ll typically need:</p><ul><li><strong>Jobs table</strong>: your_service_titan_connection &gt; job_planning &gt; jobs</li><li><strong>Employees table</strong>: your_service_titan_connection &gt; settings &gt; employees</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ow1Rd2PkQBTyUP5FZoIBXA.png" /></figure><h4><strong>Step 4: Execute and Analyze</strong></h4><p>Hit run and watch Peaka generate the SQL query behind the scenes. Your results appear instantly, showing all jobs assigned to your specified employee with complete details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W9425xZk4HvsoLOrugi3iQ.png" /></figure><h4><strong>Conclusion: Fewer manual steps, faster decision-making</strong></h4><p>With Peaka’s AI chatbot, you can instantly pull any employee’s job data from ServiceTitan using simple prompts — no SQL or manual exports needed. Get immediate insights for better workforce management and faster performance reviews.</p><p><a href="https://peaka.studio/signup">Sign up to Peaka</a> for free today.</p><p><a href="https://calendly.com/peaka/demo">Book a quick demo</a> and see how Peaka can help simplify ServiceTitan reporting for you and your clients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04d7501a9968" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peaka/listing-all-jobs-for-an-employee-in-servicetitan-using-peaka-04d7501a9968">Listing All Jobs for an Employee in ServiceTitan Using Peaka</a> was originally published in <a href="https://medium.com/peaka">Peaka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to List Invoice Data Across Multiple ServiceTitan Accounts]]></title>
            <link>https://medium.com/peaka/how-to-list-invoice-data-across-multiple-servicetitan-accounts-f743f30b573e?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f743f30b573e</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[peaka]]></category>
            <category><![CDATA[servicetitan]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 11:58:25 GMT</pubDate>
            <atom:updated>2025-09-03T12:58:13.322Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*wzaTuKjhmnHkLiQT3rbiBQ.png" /></figure><p>Managing invoice data across multiple ServiceTitan accounts is a common challenge for PE firms and multi-location service businesses. Whether you’re consolidating financial reports, analyzing revenue trends across brands, or preparing investor updates, you need an efficient way to pull invoice data from all your ServiceTitan instances.</p><p>Peaka offers multiple ways to access and analyze your ServiceTitan data — through SQL queries, table views, or our AI chatbot. This flexibility means you can get the consolidated invoice data you need from multiple accounts, regardless of your technical background.</p><p>In this guide, we’ll walk you through connecting multiple ServiceTitan accounts to Peaka and use our AI chatbot to instantly retrieve and consolidate invoice data across your entire portfolio — no SQL required.</p><h3><strong>Setting Up Your ServiceTitan Connections</strong></h3><p>Before you can query employee job data, you’ll need to connect your ServiceTitan account to Peaka. The process is straightforward and takes just a few minutes.</p><p>First, navigate to the Connections section in your Peaka workspace and select ServiceTitan from the available integrations. You’ll need your ServiceTitan API credentials, which you can generate from your ServiceTitan admin panel.</p><p>Once connected, Peaka will automatically sync your ServiceTitan data, including employee records, job assignments, and scheduling information. This gives you immediate access to query any employee’s job history through our platform.</p><p>For detailed step-by-step instructions, check out our comprehensive guide: <a href="https://docs.peaka.com/integrations/service-titan">Connect your ServiceTitan Account to Peaka</a></p><h3><strong>Getting Invoices Data in 4 Simple Steps</strong></h3><p>Once your ServiceTitan data is flowing into Peaka, retrieving invoice information becomes incredibly straightforward. Here’s how to pull all invoices from multiple ServiceTitan accounts:</p><h4><strong>Step 1: Start a New Query</strong></h4><p>Navigate to your Peaka workspace and create a new query. Select the <strong>AI|GPT</strong> section to access our natural language query interface.</p><p><em>Pro tip: New to Peaka queries? Check out our </em><a href="https://docs.peaka.com/connecting-your-data/peaka-query#what-is-a-peaka-query"><em>comprehensive guide</em></a><em> to get up to speed.</em></p><h4><strong>Step 2: Ask in Plain English</strong></h4><p>Simply type your request in natural language. For example:</p><pre>List all invoices from all of my ServiceTitan accounts.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTrKWNgjm6YK278fRqfbIA.png" /></figure><h4><strong>Step 3: Select Your Data Sources</strong></h4><p>Peaka will automatically suggest the relevant tables. For employee job data, you’ll typically need:</p><ul><li><strong>Invoices Table </strong>: your_service_titan_connection &gt; accounting &gt; invoices</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eAVGyAr0sTNMUGcEAHRfuA.png" /></figure><h4><strong>Step 4: Execute and Analyze</strong></h4><p>Hit run and watch Peaka generate the SQL query behind the scenes. Your results appear instantly, showing all jobs assigned to your specified employee with complete details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q69dgzwC9-kabzZDP-Xc8A.png" /></figure><h4><strong>Conclusion: Less data wrestling, more strategic thinking</strong></h4><p>With Peaka’s AI chatbot, you can instantly pull invoice data from multiple ServiceTitan accounts using simple prompts — no SQL or manual exports needed. Get immediate insights for better financial reporting and portfolio-wide invoice analysis.</p><p><a href="https://peaka.studio/signup">Sign up to Peaka</a> for free today.</p><p><a href="https://calendly.com/peaka/demo">Book a quick demo</a> and see how Peaka can help simplify ServiceTitan reporting for you and your clients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f743f30b573e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peaka/how-to-list-invoice-data-across-multiple-servicetitan-accounts-f743f30b573e">How to List Invoice Data Across Multiple ServiceTitan Accounts</a> was originally published in <a href="https://medium.com/peaka">Peaka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Modern React Component Library: A Guide with Vite, TypeScript, and Tailwind CSS]]></title>
            <link>https://medium.com/@mevlutcantuna/building-a-modern-react-component-library-a-guide-with-vite-typescript-and-tailwind-css-862558516b8d?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/862558516b8d</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[component-libraries]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[vitejs]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Fri, 05 Jan 2024 11:28:30 GMT</pubDate>
            <atom:updated>2025-04-05T10:23:51.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XbmOZJ6VL9fWjK0O" /><figcaption>Photo by <a href="https://unsplash.com/@giamboscaro?utm_source=medium&amp;utm_medium=referral">Giammarco Boscaro</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, I’ll show you how to make a React component library using Vite, TypeScript, and Tailwind CSS. I used pnpm in the example, but you can go with npm or yarn if you prefer.</p><p>Let’s start by creating a React project with Vite.</p><pre>pnpm create vite react-component-library --template react-ts</pre><pre>pnpm install</pre><p>After creating the project, we will delete unnecessary files like below, because we don’t need to run the project.</p><ul><li>App.tsx</li><li>App.css</li><li>main.tsx</li><li>index.html</li><li>vite-env-d.ts (if you have .env files, you need to keep it.)</li></ul><p>I want to rename my ‘src’ directory to ‘lib’ and ensure I have an ‘index.ts’ file in the ‘lib’ directory to export a specific component. Let’s create it in the ‘lib’ directory.</p><p>Once the files are created and cleaned up, let’s install Tailwind CSS for styling. Follow the instructions below;</p><pre>pnpm install -D tailwindcss postcss autoprefixer</pre><pre>npx tailwindcss init -p</pre><p>Then, change your tailwind.config.js file with the below codes.</p><pre>/** @type {import(&#39;tailwindcss&#39;).Config} */<br>export default {<br>  content: [<br>    &quot;./lib/**/*.{js,ts,jsx,tsx}&quot;,<br>  ],<br>  theme: {<br>    extend: {},<br>  },<br>  plugins: [],<br>}</pre><p>And don’t forget to add the Tailwind directives to your ‘index.css’ file. Then, make sure to import the ‘index.css’ file into your ‘index.ts’ file.</p><p>For instance, let’s create a ‘Button’ component in ‘lib/components/Button.tsx’.</p><pre> const Button = () =&gt; {<br>  return &lt;button className=&quot;bg-red-300 text-red-900&quot;&gt;Button&lt;/button&gt;;<br>};<br><br>export default Button;</pre><p>Then import and export Button.tsx file in the index.ts file.</p><pre>import &quot;./index.css&quot;;<br>import MyButtonComponent from &quot;./components/Button&quot;;<br><br>export { MyButtonComponent };</pre><p>Now, let’s configure the ‘package.json’ file with the following codes:</p><pre>{<br>  &quot;name&quot;: &quot;react-component-library&quot;,<br>  &quot;private&quot;: true,<br>  &quot;version&quot;: &quot;0.0.0&quot;,<br>  &quot;type&quot;: &quot;module&quot;,<br>  &quot;main&quot;: &quot;./dist/index.umd.js&quot;,<br>  &quot;module&quot;: &quot;./dist/index.es.js&quot;,<br>  &quot;types&quot;: &quot;./dist/index.d.ts&quot;,<br>  &quot;files&quot;: [<br>    &quot;dist&quot;<br>  ],<br>  &quot;exports&quot;: {<br>    &quot;.&quot;: {<br>      &quot;import&quot;: &quot;./dist/index.es.js&quot;,<br>      &quot;require&quot;: &quot;./dist/index.umd.js&quot;,<br>      &quot;types&quot;: &quot;./dist/index.d.ts&quot;<br>    },<br>    &quot;./dist/style.css&quot;: &quot;./dist/style.css&quot;<br>  },<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;vite&quot;,<br>    &quot;build&quot;: &quot;tsc &amp;&amp; vite build&quot;,<br>    &quot;lint&quot;: &quot;eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0&quot;,<br>    &quot;preview&quot;: &quot;vite preview&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;react&quot;: &quot;^18.2.0&quot;,<br>    &quot;react-dom&quot;: &quot;^18.2.0&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@types/react&quot;: &quot;^18.2.43&quot;,<br>    &quot;@types/react-dom&quot;: &quot;^18.2.17&quot;,<br>    &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^6.14.0&quot;,<br>    &quot;@typescript-eslint/parser&quot;: &quot;^6.14.0&quot;,<br>    &quot;@vitejs/plugin-react-swc&quot;: &quot;^3.5.0&quot;,<br>    &quot;autoprefixer&quot;: &quot;^10.4.16&quot;,<br>    &quot;eslint&quot;: &quot;^8.55.0&quot;,<br>    &quot;eslint-plugin-react-hooks&quot;: &quot;^4.6.0&quot;,<br>    &quot;eslint-plugin-react-refresh&quot;: &quot;^0.4.5&quot;,<br>    &quot;postcss&quot;: &quot;^8.4.33&quot;,<br>    &quot;tailwindcss&quot;: &quot;^3.4.0&quot;,<br>    &quot;typescript&quot;: &quot;^5.2.2&quot;,<br>    &quot;vite&quot;: &quot;^5.0.8&quot;<br>  }<br>}</pre><p>Then, let’s configure the ‘tsconfig.json’ file with the following codes:</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;target&quot;: &quot;ES2020&quot;,<br>    &quot;useDefineForClassFields&quot;: true,<br>    &quot;lib&quot;: [&quot;ES2020&quot;, &quot;DOM&quot;, &quot;DOM.Iterable&quot;],<br>    &quot;module&quot;: &quot;ESNext&quot;,<br>    &quot;skipLibCheck&quot;: true,<br><br>    /* Bundler mode */<br>    &quot;moduleResolution&quot;: &quot;bundler&quot;,<br>    &quot;allowImportingTsExtensions&quot;: true,<br>    &quot;resolveJsonModule&quot;: true,<br>    &quot;isolatedModules&quot;: true,<br>    &quot;noEmit&quot;: true,<br>    &quot;declaration&quot;: true,<br>    &quot;jsx&quot;: &quot;react-jsx&quot;,<br>    &quot;typeRoots&quot;: [&quot;./dist/index.d.ts&quot;],<br>    <br>    /* Linting */<br>    &quot;strict&quot;: true,<br>    &quot;noUnusedLocals&quot;: true,<br>    &quot;noUnusedParameters&quot;: true,<br>    &quot;noFallthroughCasesInSwitch&quot;: true<br>  },<br>  &quot;include&quot;: [&quot;lib&quot;],<br>  &quot;references&quot;: [{ &quot;path&quot;: &quot;./tsconfig.node.json&quot; }]<br>} </pre><p>Finally, let’s set up the ‘vite.config.js’ file. If you’re using TypeScript, make sure to install ‘vite-plugin-dts’ and ‘@types/node’.</p><p>Simply run the following code in your terminal:</p><pre>pnpm install -D @types/node vite-plugin-dts</pre><p>Next, set up your ‘vite.config.js’ as shown below:</p><pre>import { defineConfig } from &quot;vite&quot;;<br>import react from &quot;@vitejs/plugin-react-swc&quot;;<br>import { resolve } from &quot;path&quot;;<br>import dts from &quot;vite-plugin-dts&quot;;<br>import tailwindcss from &quot;tailwindcss&quot;;<br><br>// https://vitejs.dev/config/<br>export default defineConfig({<br>  build: {<br>    lib: {<br>      entry: resolve(__dirname, &quot;./lib/index.ts&quot;),<br>      name: &quot;react-beautiful-timeline&quot;,<br>      fileName: (format) =&gt; `index.${format}.js`,<br>    },<br>    rollupOptions: {<br>      external: [&quot;react&quot;, &quot;react-dom&quot;, &quot;tailwindcss&quot;],<br>      output: {<br>        globals: {<br>          react: &quot;React&quot;,<br>          &quot;react-dom&quot;: &quot;ReactDOM&quot;,<br>          tailwindcss: &quot;tailwindcss&quot;,<br>        },<br>      },<br>    },<br>    sourcemap: true,<br>    emptyOutDir: true,<br>  },<br>  plugins: [react(), dts({ rollupTypes: true })],<br>  css: {<br>    postcss: {<br>      plugins: [tailwindcss],<br>    },<br>  },<br>});</pre><p>To test your component library, first run npm run build, and npm link in your library&#39;s terminal.</p><p>Then, create another react project to test the component, and execute npm link your-package-name in the terminal. Now, you can import and use your components and styles like below:</p><pre>import &#39;react-component-library/dist/style.css&#39;;<br>import { MyButtonComponent } from &quot;react-component-library&quot;<br></pre><p>For publishing on npm, use the following commands:</p><p>If you’re not logged in, make sure to log in to npm first.</p><pre>npm login</pre><pre>npm run build</pre><pre>npm publish</pre><p>That’s all! Install your React component package from npm. For more details, refer to the repository linked below.</p><p>“I’ve created another package this way. Feel free to check it out! If you’re looking for custom solutions, reach out to me or visit <a href="https://devfabrika.com/">devfabrika.com</a> — we’ll provide them as soon as possible.”</p><p>Let me know if you want any further tweaks!</p><p><strong>GitHub Repository 1</strong>: <a href="https://github.com/mevlutcantuna/react-beautiful-timeline">https://github.com/mevlutcantuna/react-beautiful-timeline</a></p><p><strong>GitHub Repository 1</strong>: <a href="https://github.com/mevlutcantuna/react-beautiful-wheel-picker">https://github.com/mevlutcantuna/react-beautiful-wheel-picker</a></p><p><strong>Contact:</strong></p><p><a href="https://linkedin.com/in/mevlutcantuna">Linkedin</a> <a href="https://github.com/mevlutcantuna">Github</a> <a href="https://twitter.com/mevlt_tuna">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=862558516b8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Big O Notation with examples?]]></title>
            <link>https://medium.com/@mevlutcantuna/what-is-big-o-notation-with-examples-27740618cb94?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/27740618cb94</guid>
            <category><![CDATA[big-o-notation]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[space-complexity]]></category>
            <category><![CDATA[time-complexity]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 11:28:45 GMT</pubDate>
            <atom:updated>2024-01-05T11:25:39.970Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNJxNq2FyJ17j9351grzaw.jpeg" /></figure><p>Big O Notation helps us to analyze and compare algorithms’ performance.In the world of algorithms, the “best-case scenario” represents the most ideal conditions under which an algorithm performs at its peak efficiency and the “worst-case scenario” represents the most challenging conditions where an algorithm takes the longest time to complete a task.</p><p>We check two complexity to analyze algorithms, they are time complexity and space complexity.</p><h4>Time Complexity</h4><p>Time complexity is a measure of how the running time of an algorithm scales with input size. It helps us compare and analyze algorithms’ efficiency in terms of their worst-case performance.</p><h4>Space Complexity</h4><p>Space complexity is a measure of how much additional memory or storage an algorithm requires as the input size increases.</p><h4><strong>Table of Contents</strong></h4><ul><li><em>O(1) — Constant Time</em></li><li><em>O(logn) — Logarithmic Time</em></li><li><em>O(n) — Linear Time</em></li><li><em>O(n²) — Quadratic Time</em></li><li><em>O(2^n) — Exponential Time Complexity</em></li></ul><h3><em>O(1) — Constant Time</em></h3><p>Regardless of the size of the input entered into the algorithm, the time taken by the algorithm is fixed.</p><p>We can give examples as below;</p><ul><li>Math problems</li><li>Search a value with index in an array</li><li>Reach hash with a key</li></ul><p><strong><em>Example:</em></strong></p><p>In below example, values of timeOfSmallArray and timeOfHugeArray will be calculated in the same time. Therefore, its complexity is O(1).</p><pre>const smallArray  = [1, 2, 3, 4, 5]<br>const hugeArray = [1, 2, 3, ... 100000000]<br><br>fucntion getFirstValueFromArray(array){<br>    const firstValue = n[0]<br>    return firstValue<br>}<br><br>let timeOfSmallArray = getFirstValueFromArray(smallArray)<br>let timeOfHugeArray = getFirstValueFromArray(hugeArray)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*nKVlAZ6c9OwtjD6-n8vHDw.png" /></figure><h3><strong>O(log n) — Logarithmic Time</strong></h3><p>They are algorithms in which the algorithm’s time increases logarithmically when the input of the algorithm increases. It is mostly used in divide and conquer problems.</p><p><strong><em>Example:</em></strong></p><p>As real world example, we have an array and contains some letters sorted in alphabetical order and we want find the given letter. First, it will check the middle of letters, if the given letter is more ahead the middle letter. it will check right side letters of the middle letter and it goes like that till finding the given letter.</p><pre>function findIndexOfLetter(array, letter) {<br>  let left = 0;<br>  let right = array.length;<br><br>  while (left &lt; right) {<br>    let middle = Math.ceil((left + right) / 2);<br><br>    if (array[middle] &gt; letter) {<br>      right = middle;<br>    } else if (array[middle] &lt; letter) {<br>      left = middle;<br>    } else {<br>      return middle;<br>    }<br>  }<br>}<br><br>findLetter([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;k&quot;, &quot;l&quot;, &quot;y&quot;, &quot;z&quot;], &quot;c&quot;); <br>// output: 2</pre><h3>O(N) — Linear Time</h3><p>As the input of the algorithm increases, the time taken increases at the same rate.</p><p>As a real world example, if a faucet fills a liter in one minute, it fills ten liters in ten minutes and fills a thousand liters in a thousand minutes. As the number of liters goes towards thousands and millions, this becomes the worst case (worst-case) for me.</p><p>In programming, this usually occurs with methods such as forEach, for, map and reduce.</p><p><strong><em>Example:</em></strong></p><p>In below example, getFirstValueFromArray(smallArray) function will be calculated sooner than getFirstValueFromArray(hugeArray), because amount of hugeArray value is bigger than amount of smallArray.</p><pre><br>const smallArray  = [1, 2, 3, 4, 5]<br>const hugeArray = [1, 2, 3, ... 100000000]<br><br>    function showEveryItemFromArray(array){<br>        for(let i=0; i &lt; array.length; i++){<br>            console.log(array[i])<br>        }<br>    }<br><br>let timeOfSmallArray = showEveryItemFromArray(smallArray)<br>let timeOfHugeArray = showEveryItemFromArray(hugeArray)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*z_GjT7UHF1MeE__PnQictQ.png" /></figure><h3>O(<strong>n²</strong>) — <strong>Quadratic Time</strong></h3><p>When the input of the algorithm increases, the duration of the algorithm increases by the square of the increment of the input.</p><p>Situations of most of basic sorting algorithms is O(n²) and it’s the worst-case of algorithm for them like examples below;</p><ul><li>Bubble Sorting Algorithm</li><li>Insertion Sorting Algorithm</li><li>Selection Sorting Algorithm</li></ul><p><strong><em>Example:</em></strong></p><p>We have an example that worst-case of bubble sorting. Its complexity is O(n²). If input includes 5 element and takes 25 seconds, and if input includes 10 element, it will take 100 seconds.</p><pre>const array = [5, 4, 3, 2, 1];<br><br>for (let i = 0; i &lt; array.length; i++) {<br>  for (let j = 0; j &lt; array.length - i - 1; j++) {<br>    if (array[j] &gt; array[j + 1]) {<br>      [array[j], array[j + 1]] = [array[j + 1], array[j]];<br>    }<br>  }<br>}<br><br>console.log(array); // Output: [1, 2, 3, 4, 5]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kLelWVP6t2YjoVoyAyDgdQ.png" /></figure><h3><em>O(2^n) — Exponential Time Complexity</em></h3><p>When the entered input increases by one, the number of operations performed doubles. As a very good example of this, the Fibonacci sequence can be shown as an example.</p><p><strong><em>Example:</em></strong></p><p>The Fibonacci number is a mathematical sequence, and the sum of the two previous numbers becomes the third number and so on. The first two numbers are 0 and 1, then it goes like that 1, 2, 3, 5, 8, 13 …</p><p>When given number for the below function is a huge number, output will reach very high value.</p><pre>const recursiveFibonacci = (n) =&gt; {<br>  if (n &lt; 2) {<br>    return n;<br>  }<br>  return recursiveFibonacci(n - 1) + recursiveFibonacci(n - 2);<br>};<br><br>recursiveFibonacci(6); <br>// Output: 8</pre><h4><strong><em>Conclusion:</em></strong></h4><p>Big O notation helps developers to analyze performances of algorithms. It provides us to optimize and make more performance algorithms.</p><h4>Resources:</h4><p><a href="https://www.freecodecamp.org/news/big-o-notation-wh">What is Big O Notation Explained — FreeCodeCamp</a></p><p><a href="https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/big-o-notation">Big O Notation — KhanAcademy</a></p><h4><strong>Contact:</strong></h4><p><a href="https://linkedin.com/in/mevlutcantuna">Linkedin</a> <a href="https://github.com/mevlutcantuna">Github</a> <a href="https://twitter.com/mevlt_tuna">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27740618cb94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Problem Solving Patterns for Programming]]></title>
            <link>https://medium.com/@mevlutcantuna/problem-solving-patterns-for-programming-67b26f9394b6?source=rss-135c340004a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/67b26f9394b6</guid>
            <category><![CDATA[algorithm-problem]]></category>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Mevlüt Can Tuna]]></dc:creator>
            <pubDate>Sun, 06 Aug 2023 11:53:51 GMT</pubDate>
            <atom:updated>2023-08-06T11:53:51.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RFNnrW54KBg9FEis" /><figcaption>Photo by <a href="https://unsplash.com/@leolander?utm_source=medium&amp;utm_medium=referral">Lino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When I’m learning and improving myself about algorithms, I took some notes and I wanted to share them.</p><p>There are more than four problem solving patterns, but I want to mention four of the most well-known.</p><p><strong>Content of Table</strong></p><ol><li>Frequency Pattern</li><li>Multiple Pointers ( Two Pointers ) Pattern</li><li>Sliding Window Pattern</li><li>Divide and Conquer Pattern</li></ol><h3><strong>Frequency Pattern</strong></h3><p>A frequency pattern uses an object or set to collect values and the frequency of those values.</p><p>We use frequency patterns to avoid using O(n²) and mostly used with an array or a string.</p><h4><strong>When should we use frequency pattern?</strong></h4><p>When we have a bunch of values and compare them to each other, we can use this pattern.</p><p>We have an example named anagram exercise</p><p>SameSquared exercise takes two parameters which are arrays and compares that the second array includes the square of every item of the first array, but the order will not be checked.</p><p>If we want to solve this exercise without a frequency pattern, the code appears below;</p><p>In this exercise, we have one for loop called the indexOf method that includes another for loop. Therefore, we faced O(n2).</p><pre>function sameSquared(arr1,arr2){<br>  // if lenghts of arrays are not same, some of items of arr1 cannot find squared number in arr2<br>  // therefore it return false<br>  if(arr1.length !== arr2.length){<br>      return false<br>  }<br><br>  for( let i = 0; i &lt; arr1.length; i++){<br>      // to find index of squared number in arr2, but indexof has a loop inside of itself<br>      let correctIndex = arr2.indexOf(arr1[i] ** 2)<br><br>      // check the element exists<br>      if(correctIndex === -1){<br>         return false<br>       } <br>       // remove the element if it exists, and to not find other same one<br>       arr2.splice(correctIndex,1)<br>   }<br><br>   return true<br>}</pre><p>If we want to do it with a frequency pattern, it appears below;</p><pre>function same(arr1,arr2){<br>    if(arr1.length !== arr2.length) return false<br><br>    // creating object to collect every item of arr1 with quantities<br>    let obj1 = {}<br>    // creating object to collect every item of arr2 with quantities<br>    let obj2 = {}<br>        <br>    // to collect every item of arr1 with quantities<br>    for(let val of arr1){<br>        obj1[val] = (obj1[val] || 0) + 1<br>    }<br><br>    // to collect every item of arr2 with quantities<br>    for(let val of arr2){<br>        obj2[val] = (obj2[val] || 0) + 1<br>    }<br><br>    for(let key in obj1){<br>        // check existing item of obj1(key) in obj2<br>        if(!(key ** 2 in obj2)){<br>            // if it doesnt have, it returns false and function stops<br>            return false<br>        }<br><br>        // check their quantities<br>        if(obj2[key ** 2] !== obj1[key]){<br>            // if it doesnt have, it returns false and function stops<br>            return false<br>        }<br>    }<br><br>    // if everythings is correct,it returns true<br>    return true<br>}</pre><h3><strong>Multiple Pointers (Two Pointers) Pattern</strong></h3><p>In this pattern, we create pointers or values that correspond to an index and move toward the beginning, end, or middle based on a certain condition.</p><p>With this pattern, we can write more efficient algorithms with minimal space and time complexity.</p><h4>When should we use multiple pointers pattern?</h4><p>We have to analyze each element of the collection compared to its other elements in an array or a list.</p><p>We have an example that name sumZero.</p><p>SumZero takes a parameter is a sorted array that includes numbers and if the sum of two numbers equals zero, it returns these numbers. If it’s not, return undefined.</p><p>If we want to solve this exercise without a multiple pointers pattern, the code appears below;</p><p>In a naive solution, we have two for loop and its time complexity is O(n2) and space complexity is O(1).</p><pre>furciton sumZero(arr){<br>    // check every item of arr<br>    for(let = i; i &lt; arr.lenght; i++){<br>        // check items that are after index that is i<br>        for(let j = i+1; j &lt; arr.length; j++){<br>            if(arr[i] + arr[j] === 0){<br>                return [arr[i],arr[j]]<br>            }<br>        }<br>    }<br>}</pre><p>If we want to do it with multiple pointers pattern, it appears below;</p><p>In this solution, its time complexity is O(n) and space complexity is O(1).</p><pre>furciton sumZero(arr){<br>    // select to first item of arr<br>    let left = 0<br>    // select to last item of arr<br>    let right = arr.length - 1<br><br>    while(right &gt; left){<br>        let sum = arr[left] + arr[right]<br><br>        if(sum === 0){<br>            return [arr[left],arr[right]]<br>        }else if(sum &gt; 0){<br>            // note: the array is sorted<br>            // if sum is greater than 0, right will be a less number<br>            right--<br>        }else{<br>            // if sum is less than 0, left will be a greater number<br>            left++<br>        }<br>    }<br>}</pre><h3><strong>Sliding Window Pattern</strong></h3><p>This pattern is useful when we have a set of data like an array or a string. We’re creating a window, and sliding in left to right in a condition.</p><h4><strong>When Should we use sliding window pattern?</strong></h4><p>When we have a string or an array and need to move over the data, we can use this pattern.</p><p>In this exercise, the function takes two parameters. The first parameter is an array and includes numbers, the second is a number. Tries to find the number with the largest sum of num numbers side by side.</p><p>In a naive solution, we have two nested for loops and its time complexity is O(n2).</p><pre>function maxSubarraySum(arr, num) {<br>  if (num &gt; arr.length) return null;<br><br>  var max = -Infinity;<br><br>  // it goes to maximum first element of biggest sum<br>  for (let i = 0; i &lt; arr.length - num + 1; i++) {<br>    // vairable in inside to compare max value<br>    temp = 0;<br>    // it sums from first item of the biggest sum to last element of the biggest sum<br>    for (let j = 0; j &lt; num; j++) {<br>      temp += arr[i + j];<br>    }<br><br>    // when max is less than temp, it equals temp to max<br>    if (temp &gt; max) {<br>      max = temp;<br>    }<br>  }<br><br>  return max;<br>}</pre><p>If we want to do it with multiple pointers pattern, it appears below;</p><p>In this solution, its time complexity is O(n).</p><pre>function maxSubarraySum(arr, num) {<br>  let maxSum = 0;<br>  let tempSum = 0;<br><br>  if (num &gt; arr.length) return null;<br><br>  // it sums first elements to maxSum in num counts<br>  for (let i = 0; i &lt; num; i++) {<br>    maxSum += arr[i];<br>  }<br><br>  // it equals to tempSum to maxSum<br>  tempSum = maxSum;<br><br>  // it subtracts first element of the sum and add up the number after the sum<br>  for (let i = num; i &lt; arr.length; i++) {<br>    tempSum = tempSum - arr[i - num] + arr[i];<br>    maxSum = Math.max(maxSum, tempSum);<br>  }<br><br>  return maxSum;<br>}</pre><h3><strong>Divide and Conquer Pattern</strong></h3><p>This pattern involves dividing a data set into smaller chunks and then repeating a process with a subset of data.</p><p>This pattern can tremendously decrease time complexity.</p><h4><strong>When should we use divide and conquer pattern?</strong></h4><p>Use the divide and conquer algorithm when a problem can be divided into smaller subproblems, solved independently, and then combined.</p><p>In this exercise, the function takes two parameters, the first is an array that includes numbers and the second is a number. The purpose is to find the second parameter in the first parameter.</p><p>In a naive solution, we have a for loop and its time complexity is O(n).</p><pre>function search(array,val){<br>  for(let i = 0; i &lt; arr.length; i++&gt;{<br>      if(arr[i] === val){<br>          return i<br>      }<br>  })<br>  return -1<br>}</pre><p>If we want to do it with multiple pointers pattern, it appears below;</p><p>In this solution, its time complexity is log(n).</p><pre>function search(array,val){<br>  let min = 0<br>  let max = array.lenth - 1<br><br>  while(min &lt;= max){<br>      let middle = Math.floor((min + max) / 2)<br>      let currentElement = array[middle]<br><br>      if(currentElement &lt; val&gt;){<br>          min = middle + 1<br>      } else if(currentElement &gt; val){<br>          max = middle - 1<br>      }else{<br>          return middle<br>      }<br>  }<br><br>  return -1<br>}</pre><h4><strong>Conclusion</strong></h4><p>Problem solving patterns enables us to make more efficient algorithms and solve algorithms quickly.</p><h4><strong>Resources</strong></h4><p><a href="https://www.udemy.com/course/js-algorithms-and-data-structures-masterclass/">JavaScript Algorithms and Data Structures MaterClass By Colt Steele</a></p><h4>Contact</h4><p><a href="https://www.linkedin.com/in/mevlutcantuna/">Linkedin</a> <a href="https://twitter.com/mevlt_tuna">Twitter</a> <a href="https://github.com/mevlutcantuna">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67b26f9394b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>