<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>2026-09-26T21:22:51Z</updated>
  <generator>https://njump.me</generator>

  <title>Nostr notes by codementor</title>
  <author>
    <name>codementor</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://njump.me/npub1u69qs4hfpkve0v0hy85s2fycjeqjm4ts8xdfs7ew3l270l87yfuspv0yg2.rss" />
  <link href="https://njump.me/npub1u69qs4hfpkve0v0hy85s2fycjeqjm4ts8xdfs7ew3l270l87yfuspv0yg2" />
  <id>https://njump.me/npub1u69qs4hfpkve0v0hy85s2fycjeqjm4ts8xdfs7ew3l270l87yfuspv0yg2</id>
  <icon>https://blossom.primal.net/d87ea72911153368b450df15f0a7cf2040490ec1fd9b9c436c967316690dfcaf.jpg</icon>
  <logo>https://blossom.primal.net/d87ea72911153368b450df15f0a7cf2040490ec1fd9b9c436c967316690dfcaf.jpg</logo>




  <entry>
    <id>https://njump.me/nevent1qqsr837f2g87zjfsqdmtk9u0cddctl5pjtx0sctrfd5cnjfaj2jhtcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlnma2k</id>
    
      <title type="html">Learn: Linear search What: check the items one by one until you ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsr837f2g87zjfsqdmtk9u0cddctl5pjtx0sctrfd5cnjfaj2jhtcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlnma2k" />
    <content type="html">
      Learn: Linear search&lt;br/&gt;&lt;br/&gt;What: check the items one by one until you find the target.&lt;br/&gt;Cost: O(n) in the worst case, O(1) extra memory.&lt;br/&gt;Use it when: the data is not sorted, is small, or you search only once. Sorting first costs O(n log n), more than one linear search.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 7, 3, 9, 1 };&lt;br/&gt;Console.WriteLine(Array.IndexOf(a, 9));&lt;br/&gt;Console.WriteLine(Array.IndexOf(a, 5));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 2, then -1 (not found). Array.IndexOf and List&amp;lt;T&amp;gt;.Contains are linear searches.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/linear-search/&#34;&gt;https://www.geeksforgeeks.org/dsa/linear-search/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-033
    </content>
    <updated>2026-10-13T18:37:58Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8jgxrpgvejtuq6pztz5sktzytxxspmn5jufganwka9wnz99nzusgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjjgza0</id>
    
      <title type="html">Learn: Starvation Starvation: a thread is ready to work but never ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8jgxrpgvejtuq6pztz5sktzytxxspmn5jufganwka9wnz99nzusgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjjgza0" />
    <content type="html">
      Learn: Starvation&lt;br/&gt;&lt;br/&gt;Starvation: a thread is ready to work but never gets the resource or CPU time, because others keep taking it. Unlike a deadlock, the program still moves; one part just never does.&lt;br/&gt;Classic example: a lock that is not fair. Monitor (lock) doesn&amp;#39;t promise first come, first served, so under heavy use one thread can keep losing.&lt;br/&gt;In .NET servers, a related problem is thread-pool starvation: blocking calls (.Result, .Wait()) hold pool threads, so new requests wait.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-080
    </content>
    <updated>2026-10-08T15:37:25Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsv0swc9lfxpg83w4mnkjjkf3hxh27pyhmhyxvjsj95x3aax2pa4ngzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxfl240</id>
    
      <title type="html">Sort &#43; two pointers: O(n log n) time, because of the sort (the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsv0swc9lfxpg83w4mnkjjkf3hxh27pyhmhyxvjsj95x3aax2pa4ngzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxfl240" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsx4cxjnk5svyyr87rwrfumd6zuxjxchvut6xssxx6xsf5xuwlc4tspz3mhxue69uhhyetvv9ujuerpd46hxtnfduxljsw5&#39;&gt;nevent1q…jsw5&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Sort &#43; two pointers: O(n log n) time, because of the sort (the docs call Array.Sort &amp;#34;an O(n log n) operation&amp;#34;). Little extra memory if you may sort in place, but the original indexes are lost.&lt;br/&gt;&lt;br/&gt;Dictionary: O(n) time on average, O(n) extra memory, and it keeps the indexes.&lt;br/&gt;&lt;br/&gt;If you need the indexes, or speed matters most, use the Dictionary.&lt;br/&gt;&lt;br/&gt;Source: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.array.sort&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.array.sort&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#arr004 · ARR-004-A2
    </content>
    <updated>2026-10-05T14:07:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsx4cxjnk5svyyr87rwrfumd6zuxjxchvut6xssxx6xsf5xuwlc4tszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5kjjen</id>
    
      <title type="html">Question: The array is NOT sorted. You need two numbers that add ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsx4cxjnk5svyyr87rwrfumd6zuxjxchvut6xssxx6xsf5xuwlc4tszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5kjjen" />
    <content type="html">
      Question: The array is NOT sorted. You need two numbers that add up to a target. Compare: sort it and use two pointers, or use a Dictionary. What does each cost?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr004 · ARR-004-Q2
    </content>
    <updated>2026-10-05T14:07:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0x7zz2a9f5u8h6fclz6ejudqk0nvgv766j00qhhh6yqc789j80cczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqg63dg</id>
    
      <title type="html">Learn: Bubble sort What: walk the array and swap neighbors that ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0x7zz2a9f5u8h6fclz6ejudqk0nvgv766j00qhhh6yqc789j80cczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqg63dg" />
    <content type="html">
      Learn: Bubble sort&lt;br/&gt;&lt;br/&gt;What: walk the array and swap neighbors that are in the wrong order; repeat until nothing moves. The biggest item &amp;#34;bubbles&amp;#34; to the end each pass.&lt;br/&gt;Cost: O(n²). With an early stop when a pass makes no swap, O(n) on already sorted data.&lt;br/&gt;Use it when: teaching, or tiny arrays. In real code use Array.Sort, which is O(n log n).&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 5, 1, 4, 2 };&lt;br/&gt;for (int end = a.Length - 1; end &amp;gt; 0; end--)&lt;br/&gt;{&lt;br/&gt;    bool swapped = false;&lt;br/&gt;    for (int i = 0; i &amp;lt; end; i&#43;&#43;)&lt;br/&gt;        if (a[i] &amp;gt; a[i &#43; 1]) { (a[i], a[i &#43; 1]) = (a[i &#43; 1], a[i]); swapped = true; }&lt;br/&gt;    if (!swapped) break; // already sorted: stop early&lt;br/&gt;}&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, a));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 2 4 5.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/bubble-sort-algorithm/&#34;&gt;https://www.geeksforgeeks.org/dsa/bubble-sort-algorithm/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-035
    </content>
    <updated>2026-10-05T11:37:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsp5gag8lqr60p5c6w75tdkf4j6ar3tkccv0wre7pvrutc30earqwszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8h84ql</id>
    
      <title type="html">Learn: Interface or abstract class? Interface: a contract with no ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsp5gag8lqr60p5c6w75tdkf4j6ar3tkccv0wre7pvrutc30earqwszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8h84ql" />
    <content type="html">
      Learn: Interface or abstract class?&lt;br/&gt;&lt;br/&gt;Interface: a contract with no instance fields (since C# 8 it can have default method bodies). Many per class. Best for &amp;#34;can do&amp;#34;: IComparable, IDisposable, services you inject.&lt;br/&gt;Abstract class: a partial implementation. Only one base class. Best for &amp;#34;is a&amp;#34; families that share code and state.&lt;br/&gt;&lt;br/&gt;A common interview answer: start with an interface; add an abstract base class when several implementations repeat the same code.&lt;br/&gt;&lt;br/&gt;#tip · TIP-050
    </content>
    <updated>2026-10-05T11:07:18Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsz4pntjhkthlz3uan8c5hjq7lxxscvsv55f2nnap7xcamtf46hu4gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jljqs43</id>
    
      <title type="html">Learn: SOLID in one post S: Single responsibility. One class, one ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsz4pntjhkthlz3uan8c5hjq7lxxscvsv55f2nnap7xcamtf46hu4gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jljqs43" />
    <content type="html">
      Learn: SOLID in one post&lt;br/&gt;&lt;br/&gt;S: Single responsibility. One class, one reason to change.&lt;br/&gt;O: Open/closed. Add behavior with new code, not by editing working code.&lt;br/&gt;L: Liskov substitution. A subclass must work anywhere its base class works.&lt;br/&gt;I: Interface segregation. Many small interfaces beat one huge one.&lt;br/&gt;D: Dependency inversion. Depend on interfaces, not concrete classes (this is what DI makes easy).&lt;br/&gt;&lt;br/&gt;In an interview, give one real example for each letter you mention.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://roadmap.sh/software-design-architecture&#34;&gt;https://roadmap.sh/software-design-architecture&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-071
    </content>
    <updated>2026-10-05T10:37:20Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsw9tg2qd425qcgarx87e5hh5hvgg0tuhmhf549gfvmpfmeky6jz4gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jptxprt</id>
    
      <title type="html">A 0 you just wrote looks exactly like an original 0. When the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsw9tg2qd425qcgarx87e5hh5hvgg0tuhmhf549gfvmpfmeky6jz4gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jptxprt" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqszgfg6f2px6d6a7etly4dpttx2uz7jhmh0mja5a83s9ltcashdmrgpz3mhxue69uhhyetvv9ujuerpd46hxtnfdu24m2ay&#39;&gt;nevent1q…m2ay&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;A 0 you just wrote looks exactly like an original 0. When the scan reaches it, it clears another row and column, and soon everything is 0.&lt;br/&gt;&lt;br/&gt;Fix: first record which rows and columns have a zero, then clear them in a second pass.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[,] m = { { 1, 2, 3 }, { 4, 0, 6 }, { 7, 8, 9 } };&lt;br/&gt;int rows = m.GetLength(0), cols = m.GetLength(1);&lt;br/&gt;var zeroRow = new bool[rows]; var zeroCol = new bool[cols];&lt;br/&gt;for (int i = 0; i &amp;lt; rows; i&#43;&#43;)&lt;br/&gt;    for (int j = 0; j &amp;lt; cols; j&#43;&#43;)&lt;br/&gt;        if (m[i, j] == 0) { zeroRow[i] = true; zeroCol[j] = true; }&lt;br/&gt;for (int i = 0; i &amp;lt; rows; i&#43;&#43;)&lt;br/&gt;    for (int j = 0; j &amp;lt; cols; j&#43;&#43;)&lt;br/&gt;        if (zeroRow[i] || zeroCol[j]) m[i, j] = 0;&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, m.Cast&amp;lt;int&amp;gt;()));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 0 3 0 0 0 7 0 9: row 2 and column 2 are cleared.&lt;br/&gt;&lt;br/&gt;#arr012 · ARR-012-A1
    </content>
    <updated>2026-10-05T10:07:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqszgfg6f2px6d6a7etly4dpttx2uz7jhmh0mja5a83s9ltcashdmrgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jn0y38m</id>
    
      <title type="html">Question: In a matrix, if a cell is 0, set its whole row and ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqszgfg6f2px6d6a7etly4dpttx2uz7jhmh0mja5a83s9ltcashdmrgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jn0y38m" />
    <content type="html">
      Question: In a matrix, if a cell is 0, set its whole row and whole column to 0.&lt;br/&gt;&lt;br/&gt;Why is it a bug to write the zeros while you are still scanning for zeros? How do you fix it?&lt;br/&gt;&lt;br/&gt;(CtCI 1.8)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr012 · ARR-012-Q1
    </content>
    <updated>2026-10-05T10:07:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsdck2rmlvr9j05dfh4889v2kqxn4dkgsv2xw5mrtudcjzv6tg2tfszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlenwpx</id>
    
      <title type="html">Learn: The three pattern families Creational: how objects get ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsdck2rmlvr9j05dfh4889v2kqxn4dkgsv2xw5mrtudcjzv6tg2tfszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlenwpx" />
    <content type="html">
      Learn: The three pattern families&lt;br/&gt;&lt;br/&gt;Creational: how objects get created. Singleton, Factory, Builder.&lt;br/&gt;Structural: how objects are put together. Decorator, Adapter, Facade.&lt;br/&gt;Behavioral: how objects talk and share work. Strategy, Observer, Command.&lt;br/&gt;&lt;br/&gt;In an interview, don&amp;#39;t just name a pattern: say the problem it solves and where you used it.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/software-design-patterns/&#34;&gt;https://www.geeksforgeeks.org/system-design/software-design-patterns/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-056
    </content>
    <updated>2026-10-05T09:37:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqwf4u992cq3gnppvalqs4my7gw6fjr2t9trum2r8pwexzunfyyfgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jedu8yv</id>
    
      <title type="html">Learn: PriorityQueue for &amp;#34;smallest first&amp;#34; .NET has ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqwf4u992cq3gnppvalqs4my7gw6fjr2t9trum2r8pwexzunfyyfgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jedu8yv" />
    <content type="html">
      Learn: PriorityQueue for &amp;#34;smallest first&amp;#34;&lt;br/&gt;&lt;br/&gt;.NET has PriorityQueue&amp;lt;TElement, TPriority&amp;gt;. Dequeue always returns the item with the lowest priority value.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var pq = new PriorityQueue&amp;lt;string, int&amp;gt;();&lt;br/&gt;pq.Enqueue(&amp;#34;low&amp;#34;, 5); pq.Enqueue(&amp;#34;urgent&amp;#34;, 1); pq.Enqueue(&amp;#34;mid&amp;#34;, 3);&lt;br/&gt;Console.WriteLine(pq.Dequeue());&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints urgent. Use it for &amp;#34;top k&amp;#34; problems, merging k sorted lists, and Dijkstra&amp;#39;s shortest path.&lt;br/&gt;&lt;br/&gt;#tip · TIP-011
    </content>
    <updated>2026-10-05T08:37:17Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsxjtncj5gdezq3rxaxatzf8hayaxfu52gytc850txvpj7l7tvs2qczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jk7mjux</id>
    
      <title type="html">Question: In the one-edit-away check, why can you return false ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsxjtncj5gdezq3rxaxatzf8hayaxfu52gytc850txvpj7l7tvs2qczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jk7mjux" />
    <content type="html">
      Question: In the one-edit-away check, why can you return false right away when the lengths differ by 2 or more?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr009 · ARR-009-Q2
    </content>
    <updated>2026-10-05T08:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsfc3593ez6wkwmwvzuuk899hpmalm5mv83d9pf0jt5qr83ajeq7qszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlcg62l</id>
    
      <title type="html">Learn: Designing a URL shortener A step-by-step way to answer the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsfc3593ez6wkwmwvzuuk899hpmalm5mv83d9pf0jt5qr83ajeq7qszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlcg62l" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95cryvjqxgcryd3dxycz6vp42scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsp2nuja&#39;&gt;naddr1qq…nuja&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Designing a URL shortener&lt;br/&gt;&lt;br/&gt;A step-by-step way to answer the classic system design question: requirements, API, short codes, storage, caching and scaling.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95cryvjqxgcryd3dxycz6vp42scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gux2sdme&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…sdme&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;designing-a-url-shortener-2&#34;&gt;Designing a URL shortener&lt;/h2&gt;

&lt;p&gt;This is one of the most common system design interview questions. Here is a simple way to walk through it.&lt;/p&gt;

&lt;h3 id=&#34;1-requirements-first-2&#34;&gt;1. Requirements first&lt;/h3&gt;

&lt;p&gt;Ask before you draw anything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Functional:&lt;/strong&gt; make a short link for a long URL; redirect a short link to the long URL.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-functional:&lt;/strong&gt; redirects must be fast; links must not collide; the service must stay up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scale:&lt;/strong&gt; how many new links a day, and how many redirects? Redirects are usually far more common than new links, so this is a &lt;em&gt;read-heavy&lt;/em&gt; system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;2-the-api-2&#34;&gt;2. The API&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;POST /links&lt;/code&gt; with the long URL returns the short code.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET /{code}&lt;/code&gt; answers with a redirect (HTTP 301 or 302) to the long URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;3-making-the-short-code-2&#34;&gt;3. Making the short code&lt;/h3&gt;

&lt;p&gt;Give every link a unique number (an ID from the database or an ID service), then write that number in base 62 (0-9, a-z, A-Z). Seven base-62 characters give about 3.5 trillion codes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;const string chars = &amp;#34;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;#34;;
long id = 125;
var code = &amp;#34;&amp;#34;;
do { code = chars[(int)(id % 62)] &#43; code; id /= 62; } while (id &amp;gt; 0);
Console.WriteLine(code);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;21&lt;/code&gt;, because 125 = 2 × 62 &#43; 1. Using unique IDs means two links can never get the same code.&lt;/p&gt;

&lt;h3 id=&#34;4-storage-2&#34;&gt;4. Storage&lt;/h3&gt;

&lt;p&gt;A simple table: code → long URL, plus creation time. Reads by code must be fast, so the code is the key. A key-value store fits well.&lt;/p&gt;

&lt;h3 id=&#34;5-making-redirects-fast-2&#34;&gt;5. Making redirects fast&lt;/h3&gt;

&lt;p&gt;Put a cache in front of the database: most traffic goes to a small number of popular links. Links rarely change, so cached copies stay correct for a long time.&lt;/p&gt;

&lt;h3 id=&#34;6-growing-2&#34;&gt;6. Growing&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;More app servers behind a &lt;strong&gt;load balancer&lt;/strong&gt;; the servers keep no state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shard&lt;/strong&gt; the storage by code when one database is not enough.&lt;/li&gt;
&lt;li&gt;Replicate data so a failed server doesn&amp;#39;t lose links.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;what-interviewers-look-for-2&#34;&gt;What interviewers look for&lt;/h3&gt;

&lt;p&gt;Clear requirements, a simple design first, then the bottlenecks: the read load, the ID generation, and what happens when a part fails.&lt;/p&gt;

&lt;p&gt;#tip · TIP-022&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-022
    </content>
    <updated>2026-10-05T07:37:37Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsyw6jg747saka3fvwdv6knk8p5akmee7s5yrdj79w936pnu28drjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsagy33</id>
    
      <title type="html">Learn: Costs worth knowing by heart Read array[i]: O(1) Search an ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsyw6jg747saka3fvwdv6knk8p5akmee7s5yrdj79w936pnu28drjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsagy33" />
    <content type="html">
      Learn: Costs worth knowing by heart&lt;br/&gt;&lt;br/&gt;Read array[i]: O(1)&lt;br/&gt;Search an unsorted array: O(n)&lt;br/&gt;Sort: O(n log n)&lt;br/&gt;HashSet or Dictionary lookup: O(1) on average&lt;br/&gt;Search a sorted array with binary search: O(log n)&lt;br/&gt;&lt;br/&gt;When you state a solution in an interview, say its Big-O with it.&lt;br/&gt;&lt;br/&gt;#tip · TIP-005
    </content>
    <updated>2026-10-05T07:07:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvaxcfvzp6jyr4m6xszq7yauevx97dcagzv0nu3y3xzyw2meglwjszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdjvtvg</id>
    
      <title type="html">Yes. Give each letter one bit of the int, and flip that bit every ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvaxcfvzp6jyr4m6xszq7yauevx97dcagzv0nu3y3xzyw2meglwjszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdjvtvg" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsqvxfpd4nfqw4zl9m507f95qzy9rmm0et00uhnznzvfan59uu6d2gpz3mhxue69uhhyetvv9ujuerpd46hxtnfduwdzd0a&#39;&gt;nevent1q…zd0a&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Yes. Give each letter one bit of the int, and flip that bit every time the letter appears. At the end, a bit is 1 exactly when its letter has an odd count.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(CanBePalindrome(&amp;#34;carrace&amp;#34;));&lt;br/&gt;&lt;br/&gt;static bool CanBePalindrome(string s)&lt;br/&gt;{&lt;br/&gt;    int bits = 0;&lt;br/&gt;    foreach (char c in s) bits ^= 1 &amp;lt;&amp;lt; (c - &amp;#39;a&amp;#39;); // flip this letter&amp;#39;s bit&lt;br/&gt;    return (bits &amp;amp; (bits - 1)) == 0;                // at most one bit is set&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True. bits &amp;amp; (bits - 1) clears the lowest 1 bit, so the result is 0 only when at most one bit was set. O(n) time, O(1) memory.&lt;br/&gt;&lt;br/&gt;#arr008 · ARR-008-A2
    </content>
    <updated>2026-10-05T06:07:31Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqvxfpd4nfqw4zl9m507f95qzy9rmm0et00uhnznzvfan59uu6d2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdyke59</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;The string has only the letters ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqvxfpd4nfqw4zl9m507f95qzy9rmm0et00uhnznzvfan59uu6d2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdyke59" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;The string has only the letters a to z. Can you solve it with a single int instead of a Dictionary?&amp;#34;&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr008 · ARR-008-Q2
    </content>
    <updated>2026-10-05T06:07:31Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsru3kt69s98t3nrhzr9qvfcw50g9qcn0nnfm0my5wkndp5ggjr46czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjwca6p</id>
    
      <title type="html">Learn: Thread-safe collections List&amp;lt;T&amp;gt; and Dictionary&amp;lt;K, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsru3kt69s98t3nrhzr9qvfcw50g9qcn0nnfm0my5wkndp5ggjr46czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjwca6p" />
    <content type="html">
      Learn: Thread-safe collections&lt;br/&gt;&lt;br/&gt;List&amp;lt;T&amp;gt; and Dictionary&amp;lt;K, V&amp;gt; are not safe to change from several threads at once. For shared data use System.Collections.Concurrent: ConcurrentDictionary and ConcurrentQueue.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var hits = new ConcurrentDictionary&amp;lt;string, int&amp;gt;();&lt;br/&gt;Parallel.For(0, 1000, _ =&amp;gt; hits.AddOrUpdate(&amp;#34;home&amp;#34;, 1, (_, n) =&amp;gt; n &#43; 1));&lt;br/&gt;Console.WriteLine(hits[&amp;#34;home&amp;#34;]);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1000: no update is lost. But your update function may run more than once, so keep it free of side effects. And hits[&amp;#34;home&amp;#34;]&#43;&#43; is NOT safe: it is a read and a write.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-081
    </content>
    <updated>2026-10-05T05:37:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2ru3r0uqt0ns9u3304dkds07t4h39ugh44rxkjrgtctu7hde0gqszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6guaed</id>
    
      <title type="html">Learn: The middleware pipeline Every request passes through a ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2ru3r0uqt0ns9u3304dkds07t4h39ugh44rxkjrgtctu7hde0gqszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6guaed" />
    <content type="html">
      Learn: The middleware pipeline&lt;br/&gt;&lt;br/&gt;Every request passes through a chain of middleware, in the order you add them in Program.cs, and the response comes back through them in reverse.&lt;br/&gt;Each one can do work, then call the next, or stop the chain (short-circuit), like the static files middleware returning a file.&lt;br/&gt;app.Use(...) adds a step that can call next; app.Run(context =&amp;gt; ...) adds a final step (not the app.Run() that starts the server).&lt;br/&gt;Order matters: exception handling first, then HTTPS, static files, routing, authentication, authorization, endpoints.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/&#34;&gt;https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-095
    </content>
    <updated>2026-10-04T18:37:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsw5flt9mdk8uh3nztpz2wyq8mh43n37zu66n7ar8jwag3ajz3uuvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxf43yn</id>
    
      <title type="html">Learn: 2D arrays in C# int[,] is a grid with rows and columns. ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsw5flt9mdk8uh3nztpz2wyq8mh43n37zu66n7ar8jwag3ajz3uuvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxf43yn" />
    <content type="html">
      Learn: 2D arrays in C#&lt;br/&gt;&lt;br/&gt;int[,] is a grid with rows and columns. Read a cell with m[row, column]. GetLength(0) is the number of rows and GetLength(1) the number of columns.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[,] m = { { 1, 2, 3 }, { 4, 5, 6 } };&lt;br/&gt;Console.WriteLine($&amp;#34;{m.GetLength(0)} rows, {m.GetLength(1)} columns, m[1, 2] = {m[1, 2]}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 2 rows, 3 columns, m[1, 2] = 6. Indexes start at 0, so m[1, 2] is row 2, column 3. m.Length is the total number of cells, here 6.&lt;br/&gt;&lt;br/&gt;There is also int[][], an array of arrays, where each row is its own array and rows can have different lengths.&lt;br/&gt;&lt;br/&gt;#arr011 · ARR-011-N
    </content>
    <updated>2026-10-04T18:07:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqsuflrq02a6l08rzfdswqpjksa0ur7xeppd2p9wrwxxkclh7l47czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju8t073</id>
    
      <title type="html">Learn: Never change a key while it is in a HashSet A HashSet or ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqsuflrq02a6l08rzfdswqpjksa0ur7xeppd2p9wrwxxkclh7l47czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju8t073" />
    <content type="html">
      Learn: Never change a key while it is in a HashSet&lt;br/&gt;&lt;br/&gt;A HashSet or Dictionary files each key by its hash code. If the key changes, its hash code changes, and the set looks in the wrong place.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var p = new Point { X = 1 };&lt;br/&gt;var set = new HashSet&amp;lt;Point&amp;gt; { p };&lt;br/&gt;p.X = 2; // changes p&amp;#39;s hash code&lt;br/&gt;Console.WriteLine(set.Contains(p));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints False, even though p is in the set. Use keys that can&amp;#39;t change, like strings, numbers or records without setters.&lt;br/&gt;&lt;br/&gt;#tip · TIP-012
    </content>
    <updated>2026-10-04T17:37:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsprjrck54h5lkg4e9yqywhgranaflnjtp5ect7rlzjujdaa7aa3sszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0404ax</id>
    
      <title type="html">Learn: The Lock type (.NET 9&#43;) .NET 9 added ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsprjrck54h5lkg4e9yqywhgranaflnjtp5ect7rlzjujdaa7aa3sszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0404ax" />
    <content type="html">
      Learn: The Lock type (.NET 9&#43;)&lt;br/&gt;&lt;br/&gt;.NET 9 added System.Threading.Lock, a type made only for locking, and lighter than locking on a plain object.&lt;br/&gt;With the .NET 10 SDK it works in async methods too (older compilers may reject this), as long as there is no await inside the lock block:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new Lock();&lt;br/&gt;await Task.Yield();&lt;br/&gt;lock (gate) { Console.WriteLine(&amp;#34;inside&amp;#34;); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints inside. An await inside the block is error CS1996, just like with any lock:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new Lock();&lt;br/&gt;lock (gate) { await Task.Delay(1); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;Need to await while holding a lock? Use SemaphoreSlim.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.threading.lock&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.threading.lock&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-075
    </content>
    <updated>2026-10-04T17:07:34Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsq4hf0zug0ckmwutmkm3mf0jvzdl7xz3tqnfml9299ptz3rj8yjvgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7j0ucq</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsq4hf0zug0ckmwutmkm3mf0jvzdl7xz3tqnfml9299ptz3rj8yjvgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7j0ucq" />
    <content type="html">
      Learn: Sharding splits data by a key&lt;br/&gt;&lt;br/&gt;When one database is too big or too busy, split the data across several databases (shards), for example by user ID.&lt;br/&gt;&lt;br/&gt;The risk is a hot shard: if one key gets most of the traffic, one shard does most of the work. Choose a key that spreads load evenly.&lt;br/&gt;&lt;br/&gt;#tip · TIP-016
    </content>
    <updated>2026-10-04T16:37:29Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqswwx5agz47k3we53g6h8fpr6vshdx6t484wva6dxnv3tmt5va4s8gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju49gme</id>
    
      <title type="html">So that a range starting at index 0 needs no special case. The ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqswwx5agz47k3we53g6h8fpr6vshdx6t484wva6dxnv3tmt5va4s8gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju49gme" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsg5u5tyg5aw0n9ak3ch7v6aya5g9alylkfqlsgl8pgmhx62ltjzvspz3mhxue69uhhyetvv9ujuerpd46hxtnfduww23dz&#39;&gt;nevent1q…23dz&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;So that a range starting at index 0 needs no special case. The sum from index 0 to j is prefix[j &#43; 1] - prefix[0], and prefix[0] is 0.&lt;br/&gt;&lt;br/&gt;Without it, you would need an if for ranges that start at 0.&lt;br/&gt;&lt;br/&gt;#arr003 · ARR-003-A2
    </content>
    <updated>2026-10-04T16:07:18Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs02496z6cyylw8xezdn570qnd9utmscnn4zykvn09wyjhfpjcegkqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jcm2zhe</id>
    
      <title type="html">Learn: Repository and Unit of Work Repository: hides data access ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs02496z6cyylw8xezdn570qnd9utmscnn4zykvn09wyjhfpjcegkqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jcm2zhe" />
    <content type="html">
      Learn: Repository and Unit of Work&lt;br/&gt;&lt;br/&gt;Repository: hides data access behind an interface like IOrderRepository with GetById and Add, so the rest of the code doesn&amp;#39;t know about SQL.&lt;br/&gt;Unit of Work: collects changes and saves them together in one transaction.&lt;br/&gt;&lt;br/&gt;Interview point: in EF Core, a DbSet already acts like a repository and the DbContext like a unit of work (SaveChanges). Add your own repository when you want to hide EF Core or make testing easier, not by habit.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/software-design-patterns/&#34;&gt;https://www.geeksforgeeks.org/system-design/software-design-patterns/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-070
    </content>
    <updated>2026-10-04T15:30:09Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2pqtqxj0ehgsxn7tlphmeexakukr9ukyjecq2xclzdd3xux0733qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jh9tj2s</id>
    
      <title type="html">Bug hunt: This Two Sum should print the indexes of two numbers ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2pqtqxj0ehgsxn7tlphmeexakukr9ukyjecq2xclzdd3xux0733qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jh9tj2s" />
    <content type="html">
      Bug hunt: This Two Sum should print the indexes of two numbers that add up to 10. The right answer is 1 2 (1 &#43; 9).&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 5, 1, 9 };&lt;br/&gt;int target = 10;&lt;br/&gt;var seen = new Dictionary&amp;lt;int, int&amp;gt;();&lt;br/&gt;for (int i = 0; i &amp;lt; a.Length; i&#43;&#43;)&lt;br/&gt;{&lt;br/&gt;    seen[a[i]] = i;&lt;br/&gt;    if (seen.TryGetValue(target - a[i], out int j))&lt;br/&gt;    { Console.WriteLine($&amp;#34;{j} {i}&amp;#34;); break; }&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;What does it print, and which line causes the bug?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr015 · ARR-015-Q1
    </content>
    <updated>2026-10-04T15:07:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs84rzqsuhm46svysqfhjsxwx6d58ky5ze3j9yg9c73eq0xl3raysszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9p5qx9</id>
    
      <title type="html">It prints 0 0. The line seen[a[i]] = i; runs before the check. At ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs84rzqsuhm46svysqfhjsxwx6d58ky5ze3j9yg9c73eq0xl3raysszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9p5qx9" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs2pqtqxj0ehgsxn7tlphmeexakukr9ukyjecq2xclzdd3xux0733qpz3mhxue69uhhyetvv9ujuerpd46hxtnfduwjm7k2&#39;&gt;nevent1q…m7k2&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;It prints 0 0.&lt;br/&gt;&lt;br/&gt;The line seen[a[i]] = i; runs before the check. At i = 0 it stores 5, then looks for 10 - 5 = 5 and finds the 5 it just stored. The same item is used twice.&lt;br/&gt;&lt;br/&gt;Fix: check first, then add.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 5, 1, 9 };&lt;br/&gt;int target = 10;&lt;br/&gt;var seen = new Dictionary&amp;lt;int, int&amp;gt;();&lt;br/&gt;for (int i = 0; i &amp;lt; a.Length; i&#43;&#43;)&lt;br/&gt;{&lt;br/&gt;    if (seen.TryGetValue(target - a[i], out int j))&lt;br/&gt;    { Console.WriteLine($&amp;#34;{j} {i}&amp;#34;); break; }&lt;br/&gt;    seen[a[i]] = i;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 2. Now the Dictionary holds only earlier items, so an item can&amp;#39;t pair with itself.&lt;br/&gt;&lt;br/&gt;#arr015 · ARR-015-A1
    </content>
    <updated>2026-10-04T15:07:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqsfkg4hl2e0lkvqv8t5mfc3hux7ngeq8s7236l9hqpct30uluk7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6um04u</id>
    
      <title type="html">Learn: Race condition When two threads read and write the same ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqsfkg4hl2e0lkvqv8t5mfc3hux7ngeq8s7236l9hqpct30uluk7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6um04u" />
    <content type="html">
      Learn: Race condition&lt;br/&gt;&lt;br/&gt;When two threads read and write the same data at once, the result depends on who gets there first. count&#43;&#43; looks like one step, but it is read, add, write: two threads can read the same old value and one update is lost.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int count = 0;&lt;br/&gt;Parallel.For(0, 100_000, _ =&amp;gt; Interlocked.Increment(ref count));&lt;br/&gt;Console.WriteLine(count);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 100000 every time. With plain count&#43;&#43; it can print less. Fixes: Interlocked for simple counters, lock for more.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-073
    </content>
    <updated>2026-10-04T14:37:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0ytz3el76mqn9sl0gknjse2m0u53r3n2p5hjqa33xwtxvk2976wgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je5ucdx</id>
    
      <title type="html">Question: Rewrite the recursive Sum(n) with a loop. What is its ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0ytz3el76mqn9sl0gknjse2m0u53r3n2p5hjqa33xwtxvk2976wgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je5ucdx" />
    <content type="html">
      Question: Rewrite the recursive Sum(n) with a loop. What is its space complexity now?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big003 · BIG-003-Q2
    </content>
    <updated>2026-10-04T14:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs9lt65quangm5vsk0kveh0fz35dzuxnnx8ggukwymkly8llx36nggzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jcn2h07</id>
    
      <title type="html">```csharp int total = 0; for (int i = 1; i &amp;lt;= 5; i&#43;&#43;) total &#43;= ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs9lt65quangm5vsk0kveh0fz35dzuxnnx8ggukwymkly8llx36nggzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jcn2h07" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs0ytz3el76mqn9sl0gknjse2m0u53r3n2p5hjqa33xwtxvk2976wgpz3mhxue69uhhyetvv9ujuerpd46hxtnfdufv85q8&#39;&gt;nevent1q…85q8&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int total = 0;&lt;br/&gt;for (int i = 1; i &amp;lt;= 5; i&#43;&#43;) total &#43;= i;&lt;br/&gt;Console.WriteLine(total);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 15, like the recursive version.&lt;br/&gt;&lt;br/&gt;Space: O(1). There is one running total and one counter, and no calls wait on the stack. Time is still O(n).&lt;br/&gt;&lt;br/&gt;That matters in .NET: a stack overflow can&amp;#39;t be caught, it ends the whole process.&lt;br/&gt;&lt;br/&gt;#big003 · BIG-003-A2
    </content>
    <updated>2026-10-04T14:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8q2qlx98z77gtpajt9ca92h7ez2u8j5l74h4d3dyeplq9xxdpupgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ja0keqh</id>
    
      <title type="html">Learn: Strings What: a sequence of characters. In C# a string ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8q2qlx98z77gtpajt9ca92h7ez2u8j5l74h4d3dyeplq9xxdpupgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ja0keqh" />
    <content type="html">
      Learn: Strings&lt;br/&gt;&lt;br/&gt;What: a sequence of characters. In C# a string can&amp;#39;t change: every &amp;#34;change&amp;#34; makes a new string.&lt;br/&gt;Interview favorites: reverse, palindrome, anagram, count characters, longest substring.&lt;br/&gt;Tip: turn it into a char[] to change it in place, or use StringBuilder to build it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;string s = &amp;#34;hello&amp;#34;;&lt;br/&gt;char[] a = s.ToCharArray();&lt;br/&gt;Array.Reverse(a);&lt;br/&gt;Console.WriteLine(new string(a));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints olleh.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/string-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/string-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-029
    </content>
    <updated>2026-10-04T13:37:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvs2sh3fmn3jwmug4wu3aejmmx6dtes6265rc9jcnwr35xmc9zkcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsvm80z</id>
    
      <title type="html">Learn: Async mistakes interviewers ask about async void: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvs2sh3fmn3jwmug4wu3aejmmx6dtes6265rc9jcnwr35xmc9zkcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsvm80z" />
    <content type="html">
      Learn: Async mistakes interviewers ask about&lt;br/&gt;&lt;br/&gt;async void: exceptions can&amp;#39;t be caught by the caller and can crash the app. Use async Task (only event handlers are async void).&lt;br/&gt;.Result or .Wait() in a request: blocks a pool thread; under load, thread-pool starvation.&lt;br/&gt;Ignoring CancellationToken: when the user leaves, the work keeps running. Pass the request&amp;#39;s token down.&lt;br/&gt;Task.Run in a controller: moves work to another pool thread and gains nothing.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-068
    </content>
    <updated>2026-10-04T13:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8d539csmyah68ll8u43jgede4c3mxlf78sgqy2qm7u98aqcym6ugzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3fhjpu</id>
    
      <title type="html">Learn: Task vs Thread A Thread is an operating system thread: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8d539csmyah68ll8u43jgede4c3mxlf78sgqy2qm7u98aqcym6ugzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3fhjpu" />
    <content type="html">
      Learn: Task vs Thread&lt;br/&gt;&lt;br/&gt;A Thread is an operating system thread: expensive to create, and it holds memory the whole time.&lt;br/&gt;A Task is a promise of a result. CPU work started with Task.Run runs on a shared pool of threads. A task waiting for I/O (a web call, a database) holds no thread at all while it waits.&lt;br/&gt;&lt;br/&gt;In modern C#, use Task and async/await; create a Thread yourself only for rare long-running, dedicated work.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-045
    </content>
    <updated>2026-10-04T12:37:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsdhecl03f5lz9aemcvghp78fpvh0kp7lp97wlm068z6v3xf7d9zlqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp3akws</id>
    
      <title type="html">Question: Rotate a square n×n matrix 90 degrees clockwise, in ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsdhecl03f5lz9aemcvghp78fpvh0kp7lp97wlm068z6v3xf7d9zlqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp3akws" />
    <content type="html">
      Question: Rotate a square n×n matrix 90 degrees clockwise, in place.&lt;br/&gt;&lt;br/&gt;(CtCI 1.7)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr011 · ARR-011-Q1
    </content>
    <updated>2026-10-04T12:07:24Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsg277pjy6sjat3yu3vm75q7fsn84nd0gtmv450ra7zv8zsqc4cszqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlg2kkg</id>
    
      <title type="html">Step 1: transpose. Swap m[i, j] with m[j, i], so rows become ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsg277pjy6sjat3yu3vm75q7fsn84nd0gtmv450ra7zv8zsqc4cszqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlg2kkg" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsdhecl03f5lz9aemcvghp78fpvh0kp7lp97wlm068z6v3xf7d9zlqpz3mhxue69uhhyetvv9ujuerpd46hxtnfdutaker8&#39;&gt;nevent1q…ker8&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Step 1: transpose. Swap m[i, j] with m[j, i], so rows become columns. Step 2: reverse each row.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[,] m = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };&lt;br/&gt;int n = m.GetLength(0);&lt;br/&gt;for (int i = 0; i &amp;lt; n; i&#43;&#43;) // 1. transpose&lt;br/&gt;    for (int j = i &#43; 1; j &amp;lt; n; j&#43;&#43;) (m[i, j], m[j, i]) = (m[j, i], m[i, j]);&lt;br/&gt;for (int i = 0; i &amp;lt; n; i&#43;&#43;) // 2. reverse each row&lt;br/&gt;    for (int j = 0; j &amp;lt; n / 2; j&#43;&#43;) (m[i, j], m[i, n - 1 - j]) = (m[i, n - 1 - j], m[i, j]);&lt;br/&gt;for (int i = 0; i &amp;lt; n; i&#43;&#43;)&lt;br/&gt;    Console.WriteLine(string.Join(&amp;#34; &amp;#34;, Enumerable.Range(0, n).Select(j =&amp;gt; m[i, j])));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 7 4 1 / 8 5 2 / 9 6 3.&lt;br/&gt;&lt;br/&gt;Time O(n²), extra memory O(1): swaps only.&lt;br/&gt;&lt;br/&gt;#arr011 · ARR-011-A1
    </content>
    <updated>2026-10-04T12:07:24Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsrvclhcwy8q40xy83seufu6ych2es8vm82z9yrannmk402309lujszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwrzzds</id>
    
      <title type="html">Learn: Test your code by hand When your code is written, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsrvclhcwy8q40xy83seufu6ych2es8vm82z9yrannmk402309lujszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwrzzds" />
    <content type="html">
      Learn: Test your code by hand&lt;br/&gt;&lt;br/&gt;When your code is written, don&amp;#39;t just say &amp;#34;done&amp;#34;. Walk through it with a small example, line by line, and say the values out loud.&lt;br/&gt;&lt;br/&gt;Then try the edge cases: an empty input, one item, and all items the same. Most bugs show up in these three.&lt;br/&gt;&lt;br/&gt;#tip · TIP-004
    </content>
    <updated>2026-10-04T11:07:27Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvry9yjtcfkyhcjq0hy959970prfszq43v0jv2e262gxm7da4v2eqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjs3che</id>
    
      <title type="html">Question: Compress a string by writing each letter with how many ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvry9yjtcfkyhcjq0hy959970prfszq43v0jv2e262gxm7da4v2eqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjs3che" />
    <content type="html">
      Question: Compress a string by writing each letter with how many times it repeats in a row. &amp;#34;aaabccdddd&amp;#34; becomes &amp;#34;a3b1c2d4&amp;#34;. If the result is not shorter, return the original.&lt;br/&gt;&lt;br/&gt;In C#, what should you use to build the result, and why?&lt;br/&gt;&lt;br/&gt;(CtCI 1.6)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr010 · ARR-010-Q1
    </content>
    <updated>2026-10-04T10:03:48Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsr6mgyjhuayeqetakjgva2064ehhhghf6kckpqd3ayam5sf5cuklgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0ydgz8</id>
    
      <title type="html">A StringBuilder. It adds characters into spare room instead of ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsr6mgyjhuayeqetakjgva2064ehhhghf6kckpqd3ayam5sf5cuklgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0ydgz8" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsvry9yjtcfkyhcjq0hy959970prfszq43v0jv2e262gxm7da4v2eqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduvxjtsc&#39;&gt;nevent1q…jtsc&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;A StringBuilder. It adds characters into spare room instead of creating a new string each time.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(Compress(&amp;#34;aaabccdddd&amp;#34;));&lt;br/&gt;Console.WriteLine(Compress(&amp;#34;abc&amp;#34;));&lt;br/&gt;&lt;br/&gt;static string Compress(string s)&lt;br/&gt;{&lt;br/&gt;    var sb = new StringBuilder();&lt;br/&gt;    for (int i = 0, run = 1; i &amp;lt; s.Length; i&#43;&#43;, run&#43;&#43;)&lt;br/&gt;        if (i &#43; 1 == s.Length || s[i] != s[i &#43; 1]) { sb.Append(s[i]).Append(run); run = 0; }&lt;br/&gt;    return sb.Length &amp;lt; s.Length ? sb.ToString() : s;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints a3b1c2d4, then abc (&amp;#34;a1b1c1&amp;#34; would be longer).&lt;br/&gt;&lt;br/&gt;The docs warn that because strings are immutable, repeated additions &amp;#34;can exact a significant performance penalty&amp;#34;.&lt;br/&gt;&lt;br/&gt;Source: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.string&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.string&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#arr010 · ARR-010-A1
    </content>
    <updated>2026-10-04T10:03:48Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvepex3skex7ek8xmtmjndf3s3qgm2qu9f7xvghmv406jg233u54qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je4huhr</id>
    
      <title type="html">Learn: SemaphoreSlim, the async-friendly lock A semaphore lets up ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvepex3skex7ek8xmtmjndf3s3qgm2qu9f7xvghmv406jg233u54qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je4huhr" />
    <content type="html">
      Learn: SemaphoreSlim, the async-friendly lock&lt;br/&gt;&lt;br/&gt;A semaphore lets up to N callers in at a time. With N = 1 it is a lock that works with await.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new SemaphoreSlim(1, 1); // one caller at a time, and it works with await&lt;br/&gt;await gate.WaitAsync();&lt;br/&gt;try { await Task.Delay(10); Console.WriteLine(&amp;#34;saved&amp;#34;); }&lt;br/&gt;finally { gate.Release(); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints saved. Always release in finally.&lt;br/&gt;Use it to protect code that awaits, or to limit concurrency: new SemaphoreSlim(5, 5) for &amp;#34;at most 5 downloads&amp;#34; (give both numbers, or an extra Release raises the limit). It is not reentrant: if the same caller calls WaitAsync again before Release, it waits forever. WaitAsync can also take a CancellationToken.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/overview-of-synchronization-primitives&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/overview-of-synchronization-primitives&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-077
    </content>
    <updated>2026-10-04T09:37:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0tzyavvk6nexaww56ws4c6gz0vtuh79mvvgdayp2y24jk8cekpuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvxrzkv</id>
    
      <title type="html">Learn: Data structures: which one when? A one-page cheat sheet: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0tzyavvk6nexaww56ws4c6gz0vtuh79mvvgdayp2y24jk8cekpuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvxrzkv" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vp52scnyvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rskjmg04&#39;&gt;naddr1qq…mg04&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Data structures: which one when?&lt;br/&gt;&lt;br/&gt;A one-page cheat sheet: what each basic data structure is good at, what it costs, and the C# type to use.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vp52scnyvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guy7ytq7&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…ytq7&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;data-structures-which-one-when-2&#34;&gt;Data structures: which one when?&lt;/h2&gt;

&lt;p&gt;Pick a data structure by asking: &lt;strong&gt;what will I do most often?&lt;/strong&gt; Read by position? Look up by key? Add and remove at the ends? Keep things sorted?&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Need&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;th&gt;C# type&lt;/th&gt;
&lt;th&gt;Main cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Read by position, loop over all&lt;/td&gt;
&lt;td&gt;Array / list&lt;/td&gt;
&lt;td&gt;&lt;code&gt;int[]&lt;/code&gt;, &lt;code&gt;List&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;index O(1), middle insert O(n)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Look up by key, count, remove duplicates&lt;/td&gt;
&lt;td&gt;Hash table&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Dictionary&amp;lt;K,V&amp;gt;&lt;/code&gt;, &lt;code&gt;HashSet&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O(1) on average&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Last in, first out (undo, brackets, DFS)&lt;/td&gt;
&lt;td&gt;Stack&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Stack&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;push amortized O(1), pop O(1)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;First in, first out (BFS, jobs)&lt;/td&gt;
&lt;td&gt;Queue&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Queue&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;enqueue amortized O(1), dequeue O(1)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Always take the smallest (top k, Dijkstra)&lt;/td&gt;
&lt;td&gt;Heap&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PriorityQueue&amp;lt;T,P&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O(log n)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Keep sorted while changing, ranges&lt;/td&gt;
&lt;td&gt;Balanced tree&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SortedSet&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;SortedDictionary&amp;lt;K,V&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O(log n)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Many inserts/removes at known nodes&lt;/td&gt;
&lt;td&gt;Linked list&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LinkedList&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O(1) at a node, O(n) to find it&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Grid data&lt;/td&gt;
&lt;td&gt;Matrix&lt;/td&gt;
&lt;td&gt;&lt;code&gt;int[,]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O(rows × cols) to visit all&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Nested data&lt;/td&gt;
&lt;td&gt;Tree&lt;/td&gt;
&lt;td&gt;your own node class&lt;/td&gt;
&lt;td&gt;depends on shape&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&#34;how-to-answer-in-an-interview-2&#34;&gt;How to answer in an interview&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Say what operation the problem needs most.&lt;/li&gt;
&lt;li&gt;Pick the structure that makes &lt;em&gt;that&lt;/em&gt; operation cheap.&lt;/li&gt;
&lt;li&gt;Say the cost out loud, and the trade-off: a hash table is fast but unordered; a sorted set is ordered but O(log n).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&#34;a-quick-example-2&#34;&gt;A quick example&lt;/h3&gt;

&lt;p&gt;&amp;#34;Find if any two numbers sum to 10&amp;#34; needs fast &amp;#34;have I seen x?&amp;#34; checks, so a &lt;code&gt;HashSet&amp;lt;int&amp;gt;&lt;/code&gt; turns it into one pass:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;int[] nums = { 3, 9, 7, 1 };
var seen = new HashSet&amp;lt;int&amp;gt;();
bool found = false;
foreach (int x in nums)
{
    found |= seen.Contains(10 - x);
    seen.Add(x);
}
Console.WriteLine(found);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;True&lt;/code&gt; (3 &#43; 7 = 10).&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://roadmap.sh/datastructures-and-algorithms&#34;&gt;https://roadmap.sh/datastructures-and-algorithms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-032&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-032
    </content>
    <updated>2026-10-04T09:07:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsrnssg6em0l489n2cfnjdkvvmdfq08qdeq2gvrc8nnwhzls32thygzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7cf5y9</id>
    
      <title type="html">Learn: EF Core essentials IQueryable vs IEnumerable: filter an ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsrnssg6em0l489n2cfnjdkvvmdfq08qdeq2gvrc8nnwhzls32thygzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7cf5y9" />
    <content type="html">
      Learn: EF Core essentials&lt;br/&gt;&lt;br/&gt;IQueryable vs IEnumerable: filter an IQueryable (db.Orders.Where(...)) and EF turns it into SQL. Call ToList() first and the filter runs in memory, after loading every row.&lt;br/&gt;N&#43;1 problem: load 100 orders, then query each order&amp;#39;s customer inside a loop (or let lazy loading do it, if you turned it on) and you get 1 &#43; 100 queries. Load them together with Include(o =&amp;gt; o.Customer).&lt;br/&gt;AsNoTracking(): for read-only queries, skip change tracking; it is faster.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/ef/core/performance/efficient-querying&#34;&gt;https://learn.microsoft.com/en-us/ef/core/performance/efficient-querying&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-094
    </content>
    <updated>2026-10-04T08:37:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsx8wj04rjyr7mdpqhdgwagm0dn9quqa5x5tcuy4t2gh66df2l83aqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jkz2lgg</id>
    
      <title type="html">Question: In the counting solution, why check the lengths first? ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsx8wj04rjyr7mdpqhdgwagm0dn9quqa5x5tcuy4t2gh66df2l83aqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jkz2lgg" />
    <content type="html">
      Question: In the counting solution, why check the lengths first? And why is it enough to look for a count below zero?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr006 · ARR-006-Q2
    </content>
    <updated>2026-10-04T08:07:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsz8zhrljwn2yld0rvja7u89ulytmrzk63ff7dxvzqlvledsn5aw7szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5znt47</id>
    
      <title type="html">Strings with different lengths can&amp;#39;t have the same letters, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsz8zhrljwn2yld0rvja7u89ulytmrzk63ff7dxvzqlvledsn5aw7szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5znt47" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsx8wj04rjyr7mdpqhdgwagm0dn9quqa5x5tcuy4t2gh66df2l83aqpz3mhxue69uhhyetvv9ujuerpd46hxtnfdum327n0&#39;&gt;nevent1q…27n0&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Strings with different lengths can&amp;#39;t have the same letters, so the answer is false at once.&lt;br/&gt;&lt;br/&gt;With equal lengths, the second string subtracts exactly as much as the first one added. If no count ever goes below zero, then no count can be left above zero either. So every count ends at zero.&lt;br/&gt;&lt;br/&gt;#arr006 · ARR-006-A2
    </content>
    <updated>2026-10-04T08:07:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsdvy6cawjttn4yh6zzcp587darxjpuvyx7fchhzrfrcszq0pz588gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jd62lx0</id>
    
      <title type="html">Learn: Scale up or scale out Scale up (vertical): a bigger ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsdvy6cawjttn4yh6zzcp587darxjpuvyx7fchhzrfrcszq0pz588gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jd62lx0" />
    <content type="html">
      Learn: Scale up or scale out&lt;br/&gt;&lt;br/&gt;Scale up (vertical): a bigger machine. Simple, but there is a limit, and it is still one machine that can fail.&lt;br/&gt;&lt;br/&gt;Scale out (horizontal): more machines behind a load balancer. No hard limit, but the app must not keep user state on one server.&lt;br/&gt;&lt;br/&gt;#tip · TIP-014
    </content>
    <updated>2026-10-04T07:37:35Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsrde465k0yuf9r8hccjjja8sapg4zz9vedjwc0tu6g6ex2thpndjszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jms6pf0</id>
    
      <title type="html">Learn: Array What: items stored side by side in memory, each at ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsrde465k0yuf9r8hccjjja8sapg4zz9vedjwc0tu6g6ex2thpndjszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jms6pf0" />
    <content type="html">
      Learn: Array&lt;br/&gt;&lt;br/&gt;What: items stored side by side in memory, each at an index.&lt;br/&gt;Cost: read or write a[i] in O(1); insert or delete in the middle O(n), because items must shift.&lt;br/&gt;Use it when: you know the size, you read by position a lot, or you loop over everything.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 10, 20, 30 };&lt;br/&gt;Console.WriteLine(a[1]);&lt;br/&gt;var list = new List&amp;lt;int&amp;gt;(a) { 40 };&lt;br/&gt;Console.WriteLine(list.Count);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 20, then 4. In C#, int[] has a fixed size; List&amp;lt;T&amp;gt; is an array that grows.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/array-data-structure-guide/&#34;&gt;https://www.geeksforgeeks.org/dsa/array-data-structure-guide/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-023
    </content>
    <updated>2026-10-04T07:07:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8y0tvj24r4xyg9amw6852frmckkc8z84xzsgncqx6mlxk9myrkwczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeaa8ug</id>
    
      <title type="html">Learn: Value types vs reference types A value type (struct, int, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8y0tvj24r4xyg9amw6852frmckkc8z84xzsgncqx6mlxk9myrkwczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeaa8ug" />
    <content type="html">
      Learn: Value types vs reference types&lt;br/&gt;&lt;br/&gt;A value type (struct, int, bool, DateTime) holds its data directly; assigning it makes a copy.&lt;br/&gt;A reference type (class, string, arrays) holds a reference; two variables can point to the same object.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var p1 = new PointStruct { X = 1 }; var p2 = p1; p2.X = 9;&lt;br/&gt;var c1 = new PointClass { X = 1 }; var c2 = c1; c2.X = 9;&lt;br/&gt;Console.WriteLine($&amp;#34;{p1.X} {c1.X}&amp;#34;);&lt;br/&gt;&lt;br/&gt;struct PointStruct { public int X; }&lt;br/&gt;class PointClass { public int X; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 9: changing the copied struct didn&amp;#39;t touch the original, but both class variables see the change.&lt;br/&gt;Boxing: putting a value type into an object (object o = 5) copies it to the heap. It is slower, so avoid it in hot loops.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-100
    </content>
    <updated>2026-10-04T06:37:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsfjta6zc4ynjar8zpws0f3cjqkjyv7jhazeres7pu7ftwt2u73w5qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeqvyrt</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;Now solve it without a HashSet ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsfjta6zc4ynjar8zpws0f3cjqkjyv7jhazeres7pu7ftwt2u73w5qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeqvyrt" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;Now solve it without a HashSet or any other extra data structure.&amp;#34;&lt;br/&gt;&lt;br/&gt;What can you do, and what does it cost?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr005 · ARR-005-Q2
    </content>
    <updated>2026-10-04T06:07:33Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqszg8nae56rs3cdmu2wnln00u8cyg6dh9d4m66h2gcmzn2esnpfmsqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlneumq</id>
    
      <title type="html">Learn: Backtracking Backtracking tries every choice step by step: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqszg8nae56rs3cdmu2wnln00u8cyg6dh9d4m66h2gcmzn2esnpfmsqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlneumq" />
    <content type="html">
      Learn: Backtracking&lt;br/&gt;&lt;br/&gt;Backtracking tries every choice step by step: choose, go deeper, then undo and try the next choice. Use it for &amp;#34;all possible&amp;#34; questions: subsets, permutations, sudoku, n-queens.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var result = new List&amp;lt;string&amp;gt;();&lt;br/&gt;var chosen = new List&amp;lt;char&amp;gt;();&lt;br/&gt;Build(new[] { &amp;#39;a&amp;#39;, &amp;#39;b&amp;#39;, &amp;#39;c&amp;#39; }, 0);&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, result));&lt;br/&gt;void Build(char[] items, int i)&lt;br/&gt;{&lt;br/&gt;    if (i == items.Length) { result.Add($&amp;#34;[{string.Concat(chosen)}]&amp;#34;); return; }&lt;br/&gt;    chosen.Add(items[i]); Build(items, i &#43; 1); chosen.RemoveAt(chosen.Count - 1); // choose, go deeper, undo&lt;br/&gt;    Build(items, i &#43; 1); // skip it&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints all 8 subsets of a, b, c. Each item is taken or skipped, so n items give 2ⁿ results. Pruning makes it faster in practice: stop early as soon as a partial choice can&amp;#39;t work.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/recursion-algorithms/&#34;&gt;https://www.geeksforgeeks.org/dsa/recursion-algorithms/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-098
    </content>
    <updated>2026-10-04T05:37:16Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsx0jhrfuqp42jgxee24dgprgqekuyhld7gk69pw2gxw2e6n0m5y3czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6aqmeq</id>
    
      <title type="html">Learn: Bitwise tricks Operators: &amp;amp; (and), | (or), ^ (xor), ~ ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsx0jhrfuqp42jgxee24dgprgqekuyhld7gk69pw2gxw2e6n0m5y3czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6aqmeq" />
    <content type="html">
      Learn: Bitwise tricks&lt;br/&gt;&lt;br/&gt;Operators: &amp;amp; (and), | (or), ^ (xor), ~ (not), &amp;lt;&amp;lt; and &amp;gt;&amp;gt; (shift).&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int n = 12; // 1100 in binary&lt;br/&gt;Console.WriteLine(n &amp;amp; 1);&lt;br/&gt;Console.WriteLine((n &amp;amp; (n - 1)) == 0);&lt;br/&gt;Console.WriteLine(5 ^ 3 ^ 5);&lt;br/&gt;Console.WriteLine(1 &amp;lt;&amp;lt; 4);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;n &amp;amp; 1 is 0 for even numbers. n &amp;gt; 0 &amp;amp;&amp;amp; (n &amp;amp; (n - 1)) == 0 is true only for powers of two (.NET also has int.IsPow2). x ^ x is 0, so xor finds the one number without a pair. 1 &amp;lt;&amp;lt; 4 is 16.&lt;br/&gt;Use them for flags, compact sets of booleans, and these classic interview tricks.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/bitwise-algorithms/&#34;&gt;https://www.geeksforgeeks.org/dsa/bitwise-algorithms/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-042
    </content>
    <updated>2026-10-04T05:07:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqwvxxemn00gt2xqeqjmfc65s3psd6s6fwktrpq5vwvkudd2sy0lczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j65evap</id>
    
      <title type="html">Learn: Concurrency in .NET: which tool when A one-page map of ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqwvxxemn00gt2xqeqjmfc65s3psd6s6fwktrpq5vwvkudd2sy0lczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j65evap" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crsvjqxgcryd3dxycz6vpn2serzvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rs3jtmau&#39;&gt;naddr1qq…tmau&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Concurrency in .NET: which tool when&lt;br/&gt;&lt;br/&gt;A one-page map of .NET&amp;#39;s concurrency tools, with the bugs each one prevents.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crsvjqxgcryd3dxycz6vpn2serzvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu89myvr&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…myvr&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;concurrency-in-net-which-tool-when-2&#34;&gt;Concurrency in .NET: which tool when&lt;/h2&gt;

&lt;p&gt;When several threads touch the same data, three bugs appear: &lt;strong&gt;race conditions&lt;/strong&gt; (lost updates), &lt;strong&gt;deadlocks&lt;/strong&gt; (threads waiting on each other forever) and &lt;strong&gt;starvation&lt;/strong&gt; (some work never gets a turn). Pick the tool that fits the situation.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Add to a shared counter&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Interlocked&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;atomic, no lock needed&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Protect a few lines of sync code&lt;/td&gt;
&lt;td&gt;&lt;code&gt;lock&lt;/code&gt; (on a private object, or &lt;code&gt;Lock&lt;/code&gt; in .NET 9&#43;)&lt;/td&gt;
&lt;td&gt;simple, fast; no &lt;code&gt;await&lt;/code&gt; inside&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Protect code that uses &lt;code&gt;await&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SemaphoreSlim(1, 1)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;works with &lt;code&gt;WaitAsync&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Limit how many run at once&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SemaphoreSlim(n, n)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;lets n callers in&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;One lock across processes&lt;/td&gt;
&lt;td&gt;named &lt;code&gt;Mutex&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;visible to other processes&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Many readers, few writers&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ReaderWriterLockSlim&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;readers don&amp;#39;t block each other; not for async code&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Shared dictionary or queue&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ConcurrentDictionary&lt;/code&gt;, &lt;code&gt;ConcurrentQueue&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;thread-safe operations&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Hand work from producers to consumers&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Channel&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;async queue; a bounded one makes fast producers wait&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Wait for I/O&lt;/td&gt;
&lt;td&gt;&lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;no thread held while waiting&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&#34;rules-that-prevent-most-bugs-2&#34;&gt;Rules that prevent most bugs&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Share as little as possible. Immutable data needs no lock.&lt;/li&gt;
&lt;li&gt;Keep locked blocks short, and never call unknown code (events, callbacks) while holding a lock.&lt;/li&gt;
&lt;li&gt;Take locks in one fixed order to avoid deadlocks.&lt;/li&gt;
&lt;li&gt;Don&amp;#39;t block on async code (&lt;code&gt;.Result&lt;/code&gt;, &lt;code&gt;.Wait()&lt;/code&gt;); in ASP.NET Core it starves the thread pool.&lt;/li&gt;
&lt;li&gt;You can&amp;#39;t &lt;code&gt;await&lt;/code&gt; inside a &lt;code&gt;lock&lt;/code&gt;; use &lt;code&gt;SemaphoreSlim&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;readers-and-writers-2&#34;&gt;Readers and writers&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;var rw = new ReaderWriterLockSlim();
var prices = new Dictionary&amp;lt;string, int&amp;gt; { [&amp;#34;tea&amp;#34;] = 3 };
rw.EnterReadLock(); try { Console.WriteLine(prices[&amp;#34;tea&amp;#34;]); } finally { rw.ExitReadLock(); }
rw.EnterWriteLock(); try { prices[&amp;#34;tea&amp;#34;] = 4; } finally { rw.ExitWriteLock(); }
Console.WriteLine(prices[&amp;#34;tea&amp;#34;]);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;3&lt;/code&gt;, then &lt;code&gt;4&lt;/code&gt;. Many threads can hold the read lock together; the write lock is exclusive. For short sections a plain &lt;code&gt;lock&lt;/code&gt; is often just as fast.&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-082&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-082
    </content>
    <updated>2026-10-03T18:37:29Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsgq66qhu56ylsnj5k3tn25jyumfkhawp8wcg93xxauwfzan3lzjwgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0xnguc</id>
    
      <title type="html">Learn: Three kinds of edits Edit problems use three operations: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsgq66qhu56ylsnj5k3tn25jyumfkhawp8wcg93xxauwfzan3lzjwgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0xnguc" />
    <content type="html">
      Learn: Three kinds of edits&lt;br/&gt;&lt;br/&gt;Edit problems use three operations:&lt;br/&gt;&lt;br/&gt;Insert: &amp;#34;cat&amp;#34; to &amp;#34;cart&amp;#34; (add r).&lt;br/&gt;Remove: &amp;#34;cat&amp;#34; to &amp;#34;at&amp;#34; (remove c).&lt;br/&gt;Replace: &amp;#34;cat&amp;#34; to &amp;#34;cut&amp;#34; (a becomes u).&lt;br/&gt;&lt;br/&gt;An insert makes a string 1 longer, a remove makes it 1 shorter, and a replace keeps its length. Comparing the lengths first often tells you which edit could have happened.&lt;br/&gt;&lt;br/&gt;#arr009 · ARR-009-N
    </content>
    <updated>2026-10-03T18:07:29Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs87m83znymtr8zukdfnnm8qmaq0n2t0xhf64yw86w8plrhxe5lv9szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8454hz</id>
    
      <title type="html">Learn: Caching in one breath A cache keeps a copy of slow data ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs87m83znymtr8zukdfnnm8qmaq0n2t0xhf64yw86w8plrhxe5lv9szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8454hz" />
    <content type="html">
      Learn: Caching in one breath&lt;br/&gt;&lt;br/&gt;A cache keeps a copy of slow data (like a database result) somewhere fast (like memory). Reads get much faster.&lt;br/&gt;&lt;br/&gt;The hard part is staleness: when the real data changes, the copy is wrong. Common answers: an expiry time (TTL), or deleting the cached copy on every write.&lt;br/&gt;&lt;br/&gt;#tip · TIP-013
    </content>
    <updated>2026-10-03T17:34:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsdfja8yx2eusn8lk4mzq07f3z743j7r5c944hvdxttc53symtu5zczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juzxh36</id>
    
      <title type="html">Learn: Matrix What: a grid of rows and columns; m[row, col] reads ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsdfja8yx2eusn8lk4mzq07f3z743j7r5c944hvdxttc53symtu5zczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juzxh36" />
    <content type="html">
      Learn: Matrix&lt;br/&gt;&lt;br/&gt;What: a grid of rows and columns; m[row, col] reads one cell.&lt;br/&gt;Cost: visiting every cell is O(rows × cols).&lt;br/&gt;Use it when: data is naturally a grid: images, game boards, maps, seating plans, or a table of results in dynamic programming.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[,] grid = { { 1, 2 }, { 3, 4 } };&lt;br/&gt;int sum = 0;&lt;br/&gt;foreach (int x in grid) sum &#43;= x;&lt;br/&gt;Console.WriteLine($&amp;#34;{grid.GetLength(0)}x{grid.GetLength(1)}, sum {sum}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 2x2, sum 10. Common interview moves: walk row by row, walk the diagonal, rotate, or spiral.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/matrix/&#34;&gt;https://www.geeksforgeeks.org/dsa/matrix/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-025
    </content>
    <updated>2026-10-03T17:07:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqspdw2m3c9e9kts6zlxfnzrvf5esy2urdtzwspy9sdwe0ts04elpmczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jw0rp8h</id>
    
      <title type="html">Learn: Queue What: first in, first out, like a line at a shop. ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqspdw2m3c9e9kts6zlxfnzrvf5esy2urdtzwspy9sdwe0ts04elpmczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jw0rp8h" />
    <content type="html">
      Learn: Queue&lt;br/&gt;&lt;br/&gt;What: first in, first out, like a line at a shop. Enqueue at the back (amortized O(1)), Dequeue from the front in O(1).&lt;br/&gt;Use it when: work must be handled in arrival order: breadth-first search, task and print queues, messages between services.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var line = new Queue&amp;lt;string&amp;gt;(new[] { &amp;#34;Ann&amp;#34;, &amp;#34;Ben&amp;#34;, &amp;#34;Cho&amp;#34; });&lt;br/&gt;line.Enqueue(&amp;#34;Dan&amp;#34;);&lt;br/&gt;Console.WriteLine($&amp;#34;{line.Dequeue()} is served, {line.Count} waiting&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints Ann is served, 3 waiting.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/queue-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/queue-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-028
    </content>
    <updated>2026-10-03T16:37:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsd3ysgesm6wq8ft266t3sa6j5504f8ufzczs3p667hu4p7cc9lxqgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7gcm4u</id>
    
      <title type="html">n adds cost O(n²) in total, so one Add is O(n) on average. A ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsd3ysgesm6wq8ft266t3sa6j5504f8ufzczs3p667hu4p7cc9lxqgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7gcm4u" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqstd4v4qr45gk039c0jde2v8t9juv7h9896qeje3julu2mafmarwdcpz3mhxue69uhhyetvv9ujuerpd46hxtnfdu3ecnmq&#39;&gt;nevent1q…cnmq&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;n adds cost O(n²) in total, so one Add is O(n) on average.&lt;br/&gt;&lt;br/&gt;A copy now happens every 100 adds, and each copy moves all items so far: 100 &#43; 200 &#43; 300 &#43; ... up to n. That is about n²/200 items.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int n = 10_000;&lt;br/&gt;long byPlus100 = 0, byDoubling = 0;&lt;br/&gt;for (int cap = 100; cap &amp;lt; n; cap &#43;= 100) byPlus100 &#43;= cap; // each full array is copied&lt;br/&gt;for (int cap = 4; cap &amp;lt; n; cap *= 2) byDoubling &#43;= cap;&lt;br/&gt;Console.WriteLine($&amp;#34;&#43;100: {byPlus100} copies, x2: {byDoubling} copies&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints &#43;100: 495000 copies, x2: 16380 copies. For n = 10,000, n²/200 is 500,000, but 2n is only 20,000.&lt;br/&gt;&lt;br/&gt;With doubling, the copies are 4 &#43; 8 &#43; 16 &#43; ..., which stays under 2n. That is why only multiplying the size gives amortized O(1).&lt;br/&gt;&lt;br/&gt;#big012 · BIG-012-A1
    </content>
    <updated>2026-10-03T15:07:27Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqstd4v4qr45gk039c0jde2v8t9juv7h9896qeje3julu2mafmarwdczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jf5xa5f</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;Your list does not double. When ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqstd4v4qr45gk039c0jde2v8t9juv7h9896qeje3julu2mafmarwdczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jf5xa5f" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;Your list does not double. When it is full, it grows by 100 slots. What do n adds cost in total now? And one Add on average?&amp;#34;&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big012 · BIG-012-Q1
    </content>
    <updated>2026-10-03T15:07:27Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8pg7qq34wr3f02dv83e5cecj26l2wyue9da4qjenrx7hzs5naudgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsc7czk</id>
    
      <title type="html">Question: Two Sum with a Dictionary uses O(n) extra memory. When ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8pg7qq34wr3f02dv83e5cecj26l2wyue9da4qjenrx7hzs5naudgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsc7czk" />
    <content type="html">
      Question: Two Sum with a Dictionary uses O(n) extra memory. When would you use two pointers instead?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr002 · ARR-002-Q2
    </content>
    <updated>2026-10-03T14:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsxsj2rek8dqnacxwfh8tfdckns2qg7dfqyc58mw0a2h5cp4a383rgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlses0n</id>
    
      <title type="html">When the array is already sorted. Then two pointers from both ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsxsj2rek8dqnacxwfh8tfdckns2qg7dfqyc58mw0a2h5cp4a383rgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlses0n" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs8pg7qq34wr3f02dv83e5cecj26l2wyue9da4qjenrx7hzs5naudgpz3mhxue69uhhyetvv9ujuerpd46hxtnfduyrfha6&#39;&gt;nevent1q…fha6&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;When the array is already sorted. Then two pointers from both ends find the pair in O(n) time with O(1) memory.&lt;br/&gt;&lt;br/&gt;If the array is not sorted, sorting first costs O(n log n), and you lose the original indexes unless you sort (value, index) pairs. So the Dictionary is usually better.&lt;br/&gt;&lt;br/&gt;#arr002 · ARR-002-A2
    </content>
    <updated>2026-10-03T14:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0sr2sjrwa9hszkf7u6ddv5dmfc7gf4dgn7070hv9uzesncsukwvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jk0axvc</id>
    
      <title type="html">Learn: What a load balancer does It spreads incoming requests ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0sr2sjrwa9hszkf7u6ddv5dmfc7gf4dgn7070hv9uzesncsukwvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jk0axvc" />
    <content type="html">
      Learn: What a load balancer does&lt;br/&gt;&lt;br/&gt;It spreads incoming requests over several servers, and stops sending traffic to a server that fails its health check.&lt;br/&gt;&lt;br/&gt;Simple strategies: round robin (take turns) or least connections (send to the least busy server). In an interview, mention health checks and what happens when a server dies.&lt;br/&gt;&lt;br/&gt;#tip · TIP-015
    </content>
    <updated>2026-10-03T13:37:33Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsppz6r0yrhl3m7vrpq7r5sdunwvswwzctvg6e2gx7ax5stawwujrszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5qm522</id>
    
      <title type="html">Learn: Linear search What: check the items one by one until you ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsppz6r0yrhl3m7vrpq7r5sdunwvswwzctvg6e2gx7ax5stawwujrszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5qm522" />
    <content type="html">
      Learn: Linear search&lt;br/&gt;&lt;br/&gt;What: check the items one by one until you find the target.&lt;br/&gt;Cost: O(n) in the worst case, O(1) extra memory.&lt;br/&gt;Use it when: the data is not sorted, is small, or you search only once. Sorting first costs O(n log n), more than one linear search.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 7, 3, 9, 1 };&lt;br/&gt;Console.WriteLine(Array.IndexOf(a, 9));&lt;br/&gt;Console.WriteLine(Array.IndexOf(a, 5));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 2, then -1 (not found). Array.IndexOf and List&amp;lt;T&amp;gt;.Contains are linear searches.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/linear-search/&#34;&gt;https://www.geeksforgeeks.org/dsa/linear-search/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-033
    </content>
    <updated>2026-10-03T13:07:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsv0g7wdmp6s099hr6cfjzsdtn5k5mvlcp0qu7e3pwf3ck2m0t8hxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr7h5ty</id>
    
      <title type="html">Learn: SemaphoreSlim, the async-friendly lock A semaphore lets up ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsv0g7wdmp6s099hr6cfjzsdtn5k5mvlcp0qu7e3pwf3ck2m0t8hxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr7h5ty" />
    <content type="html">
      Learn: SemaphoreSlim, the async-friendly lock&lt;br/&gt;&lt;br/&gt;A semaphore lets up to N callers in at a time. With N = 1 it is a lock that works with await.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new SemaphoreSlim(1, 1); // one caller at a time, and it works with await&lt;br/&gt;await gate.WaitAsync();&lt;br/&gt;try { await Task.Delay(10); Console.WriteLine(&amp;#34;saved&amp;#34;); }&lt;br/&gt;finally { gate.Release(); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints saved. Always release in finally.&lt;br/&gt;Use it to protect code that awaits, or to limit concurrency: new SemaphoreSlim(5, 5) for &amp;#34;at most 5 downloads&amp;#34; (give both numbers, or an extra Release raises the limit). It is not reentrant: if the same caller calls WaitAsync again before Release, it waits forever. WaitAsync can also take a CancellationToken.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/overview-of-synchronization-primitives&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/overview-of-synchronization-primitives&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-077
    </content>
    <updated>2026-10-03T12:37:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsxkgzlkenfy49aercasyvtrtfvm8tk4aqll6j2kcrgmj0960x85tgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jn6d8z3</id>
    
      <title type="html">Question: You will add 1000 items to a list. What is the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsxkgzlkenfy49aercasyvtrtfvm8tk4aqll6j2kcrgmj0960x85tgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jn6d8z3" />
    <content type="html">
      Question: You will add 1000 items to a list. What is the difference between new List&amp;lt;int&amp;gt;(1000) and new List&amp;lt;int&amp;gt;()?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big002 · BIG-002-Q2
    </content>
    <updated>2026-10-03T12:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsrs0zxh3drrqvyuprg2u2u0j6wxcu9nu3jwzlv6v046j2jy59k82gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jl299nq</id>
    
      <title type="html">new List&amp;lt;int&amp;gt;(1000) makes room for 1000 items at the start, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsrs0zxh3drrqvyuprg2u2u0j6wxcu9nu3jwzlv6v046j2jy59k82gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jl299nq" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsxkgzlkenfy49aercasyvtrtfvm8tk4aqll6j2kcrgmj0960x85tgpz3mhxue69uhhyetvv9ujuerpd46hxtnfduyaw65u&#39;&gt;nevent1q…w65u&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;new List&amp;lt;int&amp;gt;(1000) makes room for 1000 items at the start, so no Add ever has to copy the array.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var list = new List&amp;lt;int&amp;gt;(1000);&lt;br/&gt;for (int i = 0; i &amp;lt; 1000; i&#43;&#43;) list.Add(i);&lt;br/&gt;Console.WriteLine(list.Capacity);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1000: the list never grew. The docs say &amp;#34;If Count is less than Capacity, this method is an O(1) operation.&amp;#34;&lt;br/&gt;&lt;br/&gt;Source: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.add&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.add&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#big002 · BIG-002-A2
    </content>
    <updated>2026-10-03T12:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2x3pdy9jaw0fc8nvddjw7fcd0388v8f3djj2gxzjgjwx7yenak9czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j88pd9n</id>
    
      <title type="html">Learn: The lock statement lock lets only one thread at a time run ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2x3pdy9jaw0fc8nvddjw7fcd0388v8f3djj2gxzjgjwx7yenak9czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j88pd9n" />
    <content type="html">
      Learn: The lock statement&lt;br/&gt;&lt;br/&gt;lock lets only one thread at a time run a block of code; the others wait.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var sync = new object();&lt;br/&gt;int total = 0;&lt;br/&gt;Parallel.For(0, 1000, i =&amp;gt; { lock (sync) total &#43;= i; });&lt;br/&gt;Console.WriteLine(total);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 499500 (0 &#43; 1 &#43; ... &#43; 999) every time. On a plain object, lock is Monitor.Enter/Exit in a try/finally, so it is released even when an exception is thrown, and the same thread may enter it again (it is reentrant).&lt;br/&gt;Rules: lock on a private object, never on this, a string or a type. Keep the block short. You can&amp;#39;t await inside a lock.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/lock&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/lock&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-074
    </content>
    <updated>2026-10-03T11:37:18Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvmv6fszdxamqe7064guuh68y7xjrdyx5wm6mcx87wwxgwk74rfxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jap24sg</id>
    
      <title type="html">Learn: Binary search tree (BST) What: a binary tree where ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvmv6fszdxamqe7064guuh68y7xjrdyx5wm6mcx87wwxgwk74rfxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jap24sg" />
    <content type="html">
      Learn: Binary search tree (BST)&lt;br/&gt;&lt;br/&gt;What: a binary tree where everything left of a node is smaller and everything right is bigger.&lt;br/&gt;Cost: search and insert are O(log n) when the tree is balanced, but O(n) if it becomes a long chain.&lt;br/&gt;Use it when: you need data kept in sorted order while you add and remove, or ranges like &amp;#34;all values between 10 and 50&amp;#34;.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var set = new SortedSet&amp;lt;int&amp;gt; { 50, 20, 80, 10 };&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, set));&lt;br/&gt;Console.WriteLine(set.Min);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 10 20 50 80, then 10. In C#: SortedSet&amp;lt;T&amp;gt; and SortedDictionary&amp;lt;K, V&amp;gt;.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/binary-search-tree-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/binary-search-tree-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-031
    </content>
    <updated>2026-10-03T09:37:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8qd03j23qqnw7ghyx5qm0ewyyx4jc9r6qwc8hkqe2cv5zx7et8dqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3fw6f4</id>
    
      <title type="html">Learn: Async mistakes interviewers ask about async void: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8qd03j23qqnw7ghyx5qm0ewyyx4jc9r6qwc8hkqe2cv5zx7et8dqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3fw6f4" />
    <content type="html">
      Learn: Async mistakes interviewers ask about&lt;br/&gt;&lt;br/&gt;async void: exceptions can&amp;#39;t be caught by the caller and can crash the app. Use async Task (only event handlers are async void).&lt;br/&gt;.Result or .Wait() in a request: blocks a pool thread; under load, thread-pool starvation.&lt;br/&gt;Ignoring CancellationToken: when the user leaves, the work keeps running. Pass the request&amp;#39;s token down.&lt;br/&gt;Task.Run in a controller: moves work to another pool thread and gains nothing.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-068
    </content>
    <updated>2026-10-03T09:07:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsttvxlqk4huxz8sqjvp77ltjj3q9a7v7dygeryymhexqnalmfpehczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7kped5</id>
    
      <title type="html">Learn: Interface An interface is a contract: members a class must ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsttvxlqk4huxz8sqjvp77ltjj3q9a7v7dygeryymhexqnalmfpehczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7kped5" />
    <content type="html">
      Learn: Interface&lt;br/&gt;&lt;br/&gt;An interface is a contract: members a class must provide. It can&amp;#39;t hold instance data (no fields); since C# 8 it may give a method a default body.&lt;br/&gt;A class can implement many interfaces.&lt;br/&gt;Use it when: different classes should be usable the same way, for DI and testing with fakes, or plug-ins.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;IShape[] shapes = { new Square(2), new Circle(1) };&lt;br/&gt;foreach (var s in shapes) Console.WriteLine(s.Area().ToString(&amp;#34;0.00&amp;#34;));&lt;br/&gt;&lt;br/&gt;interface IShape { double Area(); }&lt;br/&gt;record Square(double Side) : IShape { public double Area() =&amp;gt; Side * Side; }&lt;br/&gt;record Circle(double R) : IShape { public double Area() =&amp;gt; Math.PI * R * R; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 4.00, then 3.14.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-048
    </content>
    <updated>2026-10-03T08:37:29Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqtlrkvgkaysutswzzg5ghm3rpnc3yk859kzw0x740ehd3hcmrl0czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8zxd0p</id>
    
      <title type="html">Question: Two strings are &amp;#34;one edit away&amp;#34; if a single ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqtlrkvgkaysutswzzg5ghm3rpnc3yk859kzw0x740ehd3hcmrl0czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j8zxd0p" />
    <content type="html">
      Question: Two strings are &amp;#34;one edit away&amp;#34; if a single insert, remove or replace turns one into the other. Zero edits also counts.&lt;br/&gt;&lt;br/&gt;&amp;#34;cat&amp;#34; and &amp;#34;cart&amp;#34;: yes. &amp;#34;cat&amp;#34; and &amp;#34;dog&amp;#34;: no. How do you check this in O(n)?&lt;br/&gt;&lt;br/&gt;(CtCI 1.5)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr009 · ARR-009-Q1
    </content>
    <updated>2026-10-03T08:07:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs9yr2qs0d56ammvrdc7rnxfaq3s09myqtge0dysme70zzjk6gusrgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5e65c5</id>
    
      <title type="html">Learn: Tree traversals The four ways to visit a tree, when each ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs9yr2qs0d56ammvrdc7rnxfaq3s09myqtge0dysme70zzjk6gusrgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5e65c5" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvdzqxgcryd3dxycz6vpn2scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsgg6d9e&#39;&gt;naddr1qq…6d9e&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Tree traversals&lt;br/&gt;&lt;br/&gt;The four ways to visit a tree, when each one is useful, and how much memory they need.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crvdzqxgcryd3dxycz6vpn2scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guttfpl9&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…fpl9&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;tree-traversals-2&#34;&gt;Tree traversals&lt;/h2&gt;

&lt;p&gt;Most tree questions start with visiting every node in some order.&lt;/p&gt;

&lt;h3 id=&#34;depth-first-recursion-2&#34;&gt;Depth-first (recursion)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pre-order:&lt;/strong&gt; node, then left, then right. Use it to copy a tree or print it top-down.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;In-order:&lt;/strong&gt; left, then node, then right. On a &lt;strong&gt;binary search tree this gives the values in sorted order&lt;/strong&gt;, a favorite interview fact.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Post-order:&lt;/strong&gt; left, then right, then node. Use it to delete a tree or compute sizes (children first).&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code&gt;var root = new Tree(2, new Tree(1, null, null), new Tree(3, null, null));
var order = new List&amp;lt;int&amp;gt;();
InOrder(root, order);
Console.WriteLine(string.Join(&amp;#34; &amp;#34;, order));

static void InOrder(Tree? t, List&amp;lt;int&amp;gt; order)
{
    if (t == null) return;
    InOrder(t.Left, order); order.Add(t.Value); InOrder(t.Right, order);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;1 2 3&lt;/code&gt;: in-order on a BST is sorted.&lt;/p&gt;

&lt;h3 id=&#34;breadth-first-level-by-level-2&#34;&gt;Breadth-first (level by level)&lt;/h3&gt;

&lt;p&gt;Use a &lt;strong&gt;queue&lt;/strong&gt;: take a node out, add its children at the back. Use it for &amp;#34;shortest path in steps&amp;#34;, &amp;#34;print level by level&amp;#34;, or &amp;#34;nodes closest to the root&amp;#34;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var root = new Tree(1, new Tree(2, new Tree(4, null, null), null), new Tree(3, null, null));
var queue = new Queue&amp;lt;Tree&amp;gt;(new[] { root });
var visited = new List&amp;lt;int&amp;gt;();
while (queue.Count &amp;gt; 0)
{
    var t = queue.Dequeue(); visited.Add(t.Value);
    if (t.Left != null) queue.Enqueue(t.Left);
    if (t.Right != null) queue.Enqueue(t.Right);
}
Console.WriteLine(string.Join(&amp;#34; &amp;#34;, visited));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;1 2 3 4&lt;/code&gt;: the root, then its children, then the next level.&lt;/p&gt;

&lt;h3 id=&#34;cost-2&#34;&gt;Cost&lt;/h3&gt;

&lt;p&gt;Every traversal visits each node once: &lt;strong&gt;O(n) time&lt;/strong&gt;. Memory: recursion uses O(h), where h is the tree&amp;#39;s height (O(log n) if balanced, O(n) if it is a chain); breadth-first keeps up to one full level in the queue.&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/tree-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/tree-data-structure/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-064&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-064
    </content>
    <updated>2026-10-03T07:37:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsgjaj5xwad5x9nd59lle8fmam07u9e0zy8tztp3lvxwytutglrndgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6txsa6</id>
    
      <title type="html">Learn: Array What: items stored side by side in memory, each at ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsgjaj5xwad5x9nd59lle8fmam07u9e0zy8tztp3lvxwytutglrndgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6txsa6" />
    <content type="html">
      Learn: Array&lt;br/&gt;&lt;br/&gt;What: items stored side by side in memory, each at an index.&lt;br/&gt;Cost: read or write a[i] in O(1); insert or delete in the middle O(n), because items must shift.&lt;br/&gt;Use it when: you know the size, you read by position a lot, or you loop over everything.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 10, 20, 30 };&lt;br/&gt;Console.WriteLine(a[1]);&lt;br/&gt;var list = new List&amp;lt;int&amp;gt;(a) { 40 };&lt;br/&gt;Console.WriteLine(list.Count);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 20, then 4. In C#, int[] has a fixed size; List&amp;lt;T&amp;gt; is an array that grows.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/array-data-structure-guide/&#34;&gt;https://www.geeksforgeeks.org/dsa/array-data-structure-guide/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-023
    </content>
    <updated>2026-10-03T07:04:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0ldfpm0eyu6fwn6kasds2uyra043hscxh7w9syqsjhe3wnxvaeeczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5ve7x3</id>
    
      <title type="html">Learn: Two pointers Two indexes walk the data instead of nested ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0ldfpm0eyu6fwn6kasds2uyra043hscxh7w9syqsjhe3wnxvaeeczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5ve7x3" />
    <content type="html">
      Learn: Two pointers&lt;br/&gt;&lt;br/&gt;Two indexes walk the data instead of nested loops. Two common shapes:&lt;br/&gt;From both ends of a sorted array, to find a pair with a given sum (here 11):&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 3, 4, 7, 9 };&lt;br/&gt;int left = 0, right = a.Length - 1, target = 11;&lt;br/&gt;while (left &amp;lt; right &amp;amp;&amp;amp; a[left] &#43; a[right] != target)&lt;br/&gt;    if (a[left] &#43; a[right] &amp;lt; target) left&#43;&#43;; else right--;&lt;br/&gt;Console.WriteLine(left &amp;lt; right ? $&amp;#34;{a[left]} &#43; {a[right]}&amp;#34; : &amp;#34;no pair&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 4 &#43; 7 (or &amp;#34;no pair&amp;#34;). Too small: move left; too big: move right.&lt;br/&gt;Same direction, to remove duplicates from a sorted array in place:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 1, 2, 3, 3 };&lt;br/&gt;int w = Math.Min(1, a.Length); // 0 for an empty array&lt;br/&gt;for (int r = 1; r &amp;lt; a.Length; r&#43;&#43;)&lt;br/&gt;    if (a[r] != a[w - 1]) a[w&#43;&#43;] = a[r];&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, a[..w]));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 2 3. Both are O(n) time, O(1) memory.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/two-pointers-technique/&#34;&gt;https://www.geeksforgeeks.org/dsa/two-pointers-technique/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-038
    </content>
    <updated>2026-10-03T06:37:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0w853ps6e6sll53sdfqtx48rhq3uerd8tvcrken4e43kml6ldw0qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwus5wk</id>
    
      <title type="html">Count each letter. A palindrome can have at most one letter with ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0w853ps6e6sll53sdfqtx48rhq3uerd8tvcrken4e43kml6ldw0qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwus5wk" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs0fynt5wwwq0mtq9w50gw7dzng6xh5hhhtyut3mhgqgyxrp8y98kspz3mhxue69uhhyetvv9ujuerpd46hxtnfdu7978wc&#39;&gt;nevent1q…78wc&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Count each letter. A palindrome can have at most one letter with an odd count: the one in the middle. Every other letter needs a partner on the other side.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(CanBePalindrome(&amp;#34;carrace&amp;#34;));&lt;br/&gt;Console.WriteLine(CanBePalindrome(&amp;#34;abcd&amp;#34;));&lt;br/&gt;&lt;br/&gt;static bool CanBePalindrome(string s)&lt;br/&gt;{&lt;br/&gt;    var counts = new Dictionary&amp;lt;char, int&amp;gt;();&lt;br/&gt;    foreach (char c in s) counts[c] = counts.GetValueOrDefault(c) &#43; 1;&lt;br/&gt;    return counts.Values.Count(n =&amp;gt; n % 2 == 1) &amp;lt;= 1;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True, then False. O(n) time.&lt;br/&gt;&lt;br/&gt;#arr008 · ARR-008-A1
    </content>
    <updated>2026-10-03T06:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0fynt5wwwq0mtq9w50gw7dzng6xh5hhhtyut3mhgqgyxrp8y98kszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqm90m2</id>
    
      <title type="html">Question: Can the letters of a string be rearranged into a ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0fynt5wwwq0mtq9w50gw7dzng6xh5hhhtyut3mhgqgyxrp8y98kszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqm90m2" />
    <content type="html">
      Question: Can the letters of a string be rearranged into a palindrome? &amp;#34;carrace&amp;#34; can: it becomes &amp;#34;racecar&amp;#34;. &amp;#34;abcd&amp;#34; can&amp;#39;t.&lt;br/&gt;&lt;br/&gt;Find a check that runs in O(n).&lt;br/&gt;&lt;br/&gt;(CtCI 1.4)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr008 · ARR-008-Q1
    </content>
    <updated>2026-10-03T06:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs022k3zwtremra90v64fs4226g8t3n2meaparky23dnu50xhkwk5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9wxup7</id>
    
      <title type="html">Learn: EF Core essentials IQueryable vs IEnumerable: filter an ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs022k3zwtremra90v64fs4226g8t3n2meaparky23dnu50xhkwk5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9wxup7" />
    <content type="html">
      Learn: EF Core essentials&lt;br/&gt;&lt;br/&gt;IQueryable vs IEnumerable: filter an IQueryable (db.Orders.Where(...)) and EF turns it into SQL. Call ToList() first and the filter runs in memory, after loading every row.&lt;br/&gt;N&#43;1 problem: load 100 orders, then query each order&amp;#39;s customer inside a loop (or let lazy loading do it, if you turned it on) and you get 1 &#43; 100 queries. Load them together with Include(o =&amp;gt; o.Customer).&lt;br/&gt;AsNoTracking(): for read-only queries, skip change tracking; it is faster.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/ef/core/performance/efficient-querying&#34;&gt;https://learn.microsoft.com/en-us/ef/core/performance/efficient-querying&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-094
    </content>
    <updated>2026-10-02T18:37:27Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8zt7jumhaah4esjrlfe9v5gzqur7mclk3jwfm4gy8fgj5zjpqh5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqly2du</id>
    
      <title type="html">Learn: Counting with an array To count lowercase letters, use an ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8zt7jumhaah4esjrlfe9v5gzqur7mclk3jwfm4gy8fgj5zjpqh5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqly2du" />
    <content type="html">
      Learn: Counting with an array&lt;br/&gt;&lt;br/&gt;To count lowercase letters, use an int array with 26 slots, one per letter. The slot for a letter c is c - &amp;#39;a&amp;#39;, because &amp;#39;a&amp;#39; - &amp;#39;a&amp;#39; is 0 and &amp;#39;z&amp;#39; - &amp;#39;a&amp;#39; is 25.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] counts = new int[26];&lt;br/&gt;foreach (char c in &amp;#34;banana&amp;#34;) counts[c - &amp;#39;a&amp;#39;]&#43;&#43;;&lt;br/&gt;Console.WriteLine($&amp;#34;a={counts[0]} b={counts[1]} n={counts[&amp;#39;n&amp;#39; - &amp;#39;a&amp;#39;]}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints a=3 b=1 n=2.&lt;br/&gt;&lt;br/&gt;One pass, O(n). This works only for a to z: an uppercase letter or a space gives a slot outside 0 to 25 and throws. For any character, a Dictionary&amp;lt;char, int&amp;gt; does the same job.&lt;br/&gt;&lt;br/&gt;#arr006 · ARR-006-N
    </content>
    <updated>2026-10-02T18:07:22Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0k5z9n8ejj5yf806nm8shgk5tvu8t97j73gs2v5ct0f8llxfk6lszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jz8cz6l</id>
    
      <title type="html">Learn: HashSet: a fast &amp;#34;have I seen this?&amp;#34; check A ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0k5z9n8ejj5yf806nm8shgk5tvu8t97j73gs2v5ct0f8llxfk6lszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jz8cz6l" />
    <content type="html">
      Learn: HashSet: a fast &amp;#34;have I seen this?&amp;#34; check&lt;br/&gt;&lt;br/&gt;A HashSet&amp;lt;T&amp;gt; stores each value at most once.&lt;br/&gt;&lt;br/&gt;Add returns true when the value is new, and false when it is already there. So one call both checks and remembers.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var seen = new HashSet&amp;lt;string&amp;gt;();&lt;br/&gt;Console.WriteLine(seen.Add(&amp;#34;cat&amp;#34;));&lt;br/&gt;Console.WriteLine(seen.Add(&amp;#34;cat&amp;#34;));&lt;br/&gt;Console.WriteLine(seen.Contains(&amp;#34;cat&amp;#34;));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True, False, True.&lt;br/&gt;&lt;br/&gt;The docs say Contains &amp;#34;is an O(1) operation&amp;#34;. Like every hash lookup, that is the average case: many collisions can slow it down. That makes HashSet the usual tool for finding repeats.&lt;br/&gt;&lt;br/&gt;Source: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1.add&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1.add&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#arr005 · ARR-005-N
    </content>
    <updated>2026-10-02T16:07:34Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsx0chuu5utk04wh9wf2rt5u0tpz6pvvzv0su77gg68pkt6jmzkqzgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9p8m6f</id>
    
      <title type="html">Learn: Deadlock Thread 1 holds lock A and waits for B. Thread 2 ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsx0chuu5utk04wh9wf2rt5u0tpz6pvvzv0su77gg68pkt6jmzkqzgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9p8m6f" />
    <content type="html">
      Learn: Deadlock&lt;br/&gt;&lt;br/&gt;Thread 1 holds lock A and waits for B. Thread 2 holds B and waits for A. Both wait forever.&lt;br/&gt;It needs four things at once:&lt;br/&gt;1. Only one thread can hold a lock.&lt;br/&gt;2. A thread holds one lock while it waits for another.&lt;br/&gt;3. Nobody can take a lock away.&lt;br/&gt;4. The waiting forms a circle.&lt;br/&gt;Prevent it: take locks in the same order, hold them briefly, use timeouts (Monitor.TryEnter).&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/threading/managed-threading-best-practices&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-079
    </content>
    <updated>2026-10-02T15:37:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsz3tgq3s29lvltyz30a9qcfrslmlyufe6kpnrxhjd59lrv2hkacmszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtyeypv</id>
    
      <title type="html">Learn: The Lock type (.NET 9&#43;) .NET 9 added ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsz3tgq3s29lvltyz30a9qcfrslmlyufe6kpnrxhjd59lrv2hkacmszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtyeypv" />
    <content type="html">
      Learn: The Lock type (.NET 9&#43;)&lt;br/&gt;&lt;br/&gt;.NET 9 added System.Threading.Lock, a type made only for locking, and lighter than locking on a plain object.&lt;br/&gt;With the .NET 10 SDK it works in async methods too (older compilers may reject this), as long as there is no await inside the lock block:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new Lock();&lt;br/&gt;await Task.Yield();&lt;br/&gt;lock (gate) { Console.WriteLine(&amp;#34;inside&amp;#34;); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints inside. An await inside the block is error CS1996, just like with any lock:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var gate = new Lock();&lt;br/&gt;lock (gate) { await Task.Delay(1); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;Need to await while holding a lock? Use SemaphoreSlim.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.threading.lock&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.threading.lock&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-075
    </content>
    <updated>2026-10-02T15:07:26Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsxy93pkumh5m9slkq9gnzrj35he6rstc4hl77pyml2pzv0nz70gxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnqfph7</id>
    
      <title type="html">Learn: Producer-consumer with Channel&amp;lt;T&amp;gt; One part of the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsxy93pkumh5m9slkq9gnzrj35he6rstc4hl77pyml2pzv0nz70gxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnqfph7" />
    <content type="html">
      Learn: Producer-consumer with Channel&amp;lt;T&amp;gt;&lt;br/&gt;&lt;br/&gt;One part of the code produces work, another consumes it, and a queue sits between them. In .NET, Channel&amp;lt;T&amp;gt; is that queue, made for async code.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var channel = Channel.CreateBounded&amp;lt;int&amp;gt;(2);&lt;br/&gt;var producer = Task.Run(async () =&amp;gt;&lt;br/&gt;{&lt;br/&gt;    for (int i = 1; i &amp;lt;= 3; i&#43;&#43;) await channel.Writer.WriteAsync(i);&lt;br/&gt;    channel.Writer.Complete();&lt;br/&gt;});&lt;br/&gt;await foreach (int item in channel.Reader.ReadAllAsync()) Console.WriteLine(item);&lt;br/&gt;await producer;&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1, 2, 3. A bounded channel holds at most N items:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var small = Channel.CreateBounded&amp;lt;int&amp;gt;(2);&lt;br/&gt;Console.WriteLine($&amp;#34;{small.Writer.TryWrite(1)} {small.Writer.TryWrite(2)} {small.Writer.TryWrite(3)}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True True False: full. By default WriteAsync then waits; other modes drop items instead.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/core/extensions/channels&#34;&gt;https://learn.microsoft.com/en-us/dotnet/core/extensions/channels&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-078
    </content>
    <updated>2026-10-02T14:37:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqspd94clgmvnj3qmu8ten3d5sm9lzt3unmv0sl3fp6nkem6tp8mrtszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j37caa6</id>
    
      <title type="html">Question: Does the two-pointer palindrome check also work for an ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqspd94clgmvnj3qmu8ten3d5sm9lzt3unmv0sl3fp6nkem6tp8mrtszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j37caa6" />
    <content type="html">
      Question: Does the two-pointer palindrome check also work for an even length, like &amp;#34;abba&amp;#34;? Where do the pointers stop?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr001 · ARR-001-Q1
    </content>
    <updated>2026-10-02T14:07:57Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsvzv33r47l563d84pssl736sk0pg2gxyl607vt7ae9x79h0ltqn2qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyqzsh9</id>
    
      <title type="html">Learn: Kubernetes in one page Pods, deployments, services and ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsvzv33r47l563d84pssl736sk0pg2gxyl607vt7ae9x79h0ltqn2qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyqzsh9" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvvjqxgcryd3dxycz6vpj2scnvvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsuj7cz4&#39;&gt;naddr1qq…7cz4&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Kubernetes in one page&lt;br/&gt;&lt;br/&gt;Pods, deployments, services and scaling: the Kubernetes words interviewers expect you to know.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crvvjqxgcryd3dxycz6vpj2scnvvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guk5fmtd&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…fmtd&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;kubernetes-in-one-page-2&#34;&gt;Kubernetes in one page&lt;/h2&gt;

&lt;p&gt;Kubernetes (K8s) runs containers on a group of machines (a &lt;strong&gt;cluster&lt;/strong&gt;) and keeps them in the state you describe.&lt;/p&gt;

&lt;h3 id=&#34;the-main-objects-2&#34;&gt;The main objects&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pod:&lt;/strong&gt; the smallest unit. One or more containers that run together and share a network address.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deployment:&lt;/strong&gt; &amp;#34;keep 3 copies of this pod running, with this image.&amp;#34; Change the image and it rolls out new pods step by step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service:&lt;/strong&gt; one stable name and address in front of a changing group of pods, with load balancing between them.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ingress:&lt;/strong&gt; routes outside HTTP traffic (like &lt;code&gt;api.example.com/orders&lt;/code&gt;) to services.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ConfigMap and Secret:&lt;/strong&gt; configuration and passwords given to pods without rebuilding the image. A Secret is only base64-encoded by default, not encrypted, so limit who can read it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;what-it-does-for-you-2&#34;&gt;What it does for you&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Self-healing:&lt;/strong&gt; restarts containers that crash, replaces unhealthy ones, and only sends traffic to pods that pass their readiness check.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scaling:&lt;/strong&gt; change the number of copies, or let a Horizontal Pod Autoscaler add pods when CPU goes up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rolling updates:&lt;/strong&gt; new versions go out gradually and can be rolled back.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;you-describe-it-makes-it-true-2&#34;&gt;You describe, it makes it true&lt;/h3&gt;

&lt;p&gt;You write the &lt;strong&gt;desired state&lt;/strong&gt; in YAML (for example, 3 replicas). Kubernetes keeps comparing what runs with what you asked for, and fixes any difference.&lt;/p&gt;

&lt;h3 id=&#34;interview-tips-2&#34;&gt;Interview tips&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Know the difference between a &lt;strong&gt;Pod&lt;/strong&gt; (instance), a &lt;strong&gt;Deployment&lt;/strong&gt; (keeps copies running) and a &lt;strong&gt;Service&lt;/strong&gt; (stable address).&lt;/li&gt;
&lt;li&gt;Health checks matter: a &lt;strong&gt;liveness&lt;/strong&gt; probe restarts a stuck container; a &lt;strong&gt;readiness&lt;/strong&gt; probe keeps traffic away until it is ready.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://roadmap.sh/kubernetes&#34;&gt;https://roadmap.sh/kubernetes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-062&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-062
    </content>
    <updated>2026-10-02T13:37:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0q6z4axpck862n6mwuxjhujqa2etplwm7vyus9q8a0l6y67nknvczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtppccs</id>
    
      <title type="html">Learn: Two pointers Two indexes walk the data instead of nested ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0q6z4axpck862n6mwuxjhujqa2etplwm7vyus9q8a0l6y67nknvczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtppccs" />
    <content type="html">
      Learn: Two pointers&lt;br/&gt;&lt;br/&gt;Two indexes walk the data instead of nested loops. Two common shapes:&lt;br/&gt;From both ends of a sorted array, to find a pair with a given sum (here 11):&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 3, 4, 7, 9 };&lt;br/&gt;int left = 0, right = a.Length - 1, target = 11;&lt;br/&gt;while (left &amp;lt; right &amp;amp;&amp;amp; a[left] &#43; a[right] != target)&lt;br/&gt;    if (a[left] &#43; a[right] &amp;lt; target) left&#43;&#43;; else right--;&lt;br/&gt;Console.WriteLine(left &amp;lt; right ? $&amp;#34;{a[left]} &#43; {a[right]}&amp;#34; : &amp;#34;no pair&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 4 &#43; 7 (or &amp;#34;no pair&amp;#34;). Too small: move left; too big: move right.&lt;br/&gt;Same direction, to remove duplicates from a sorted array in place:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 1, 2, 3, 3 };&lt;br/&gt;int w = Math.Min(1, a.Length); // 0 for an empty array&lt;br/&gt;for (int r = 1; r &amp;lt; a.Length; r&#43;&#43;)&lt;br/&gt;    if (a[r] != a[w - 1]) a[w&#43;&#43;] = a[r];&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, a[..w]));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 2 3. Both are O(n) time, O(1) memory.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/two-pointers-technique/&#34;&gt;https://www.geeksforgeeks.org/dsa/two-pointers-technique/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-038
    </content>
    <updated>2026-10-02T13:07:30Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsf6cyxk5xa9mnr6df7ufx7j5fs3qv69h8txwxxwfe7h7skh0zwwkczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3zgm2f</id>
    
      <title type="html">Learn: Task vs Thread A Thread is an operating system thread: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsf6cyxk5xa9mnr6df7ufx7j5fs3qv69h8txwxxwfe7h7skh0zwwkczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3zgm2f" />
    <content type="html">
      Learn: Task vs Thread&lt;br/&gt;&lt;br/&gt;A Thread is an operating system thread: expensive to create, and it holds memory the whole time.&lt;br/&gt;A Task is a promise of a result. CPU work started with Task.Run runs on a shared pool of threads. A task waiting for I/O (a web call, a database) holds no thread at all while it waits.&lt;br/&gt;&lt;br/&gt;In modern C#, use Task and async/await; create a Thread yourself only for rare long-running, dedicated work.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming&#34;&gt;https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-045
    </content>
    <updated>2026-10-02T12:37:25Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsww8dvz7hk8m4y7l0lqmwpvk3j82tkhduvgkrsfw57ahgmg4cg33szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp3uw72</id>
    
      <title type="html">Search it as it is. A linear search is O(n). Sorting alone is O(n ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsww8dvz7hk8m4y7l0lqmwpvk3j82tkhduvgkrsfw57ahgmg4cg33szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp3uw72" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsg6l0sw5wlc2gdx3fa50qkvcwcje79s9exjwxp6nhn7x3zsgncpeqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduc844qw&#39;&gt;nevent1q…44qw&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Search it as it is. A linear search is O(n). Sorting alone is O(n log n): the docs say Array.Sort is &amp;#34;an O(n log n) operation&amp;#34;.&lt;br/&gt;&lt;br/&gt;Sorting only pays off when you will search many times with a faster method.&lt;br/&gt;&lt;br/&gt;Source: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.array.sort&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.array.sort&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#big001 · BIG-001-A2
    </content>
    <updated>2026-10-02T12:07:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsg6l0sw5wlc2gdx3fa50qkvcwcje79s9exjwxp6nhn7x3zsgncpeqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j2ua0ag</id>
    
      <title type="html">Question: You need to answer one single search in an unsorted ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsg6l0sw5wlc2gdx3fa50qkvcwcje79s9exjwxp6nhn7x3zsgncpeqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j2ua0ag" />
    <content type="html">
      Question: You need to answer one single search in an unsorted list of n items. Is it faster to sort the list first and then search, or to search it as it is?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big001 · BIG-001-Q2
    </content>
    <updated>2026-10-02T12:07:28Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqxfa6xhhs6z5ggylm74uj0rlxk2spftr8dp4uqmfth42nf3k62eczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhu64gl</id>
    
      <title type="html">Learn: Producer-consumer by hand The classic whiteboard version ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqxfa6xhhs6z5ggylm74uj0rlxk2spftr8dp4uqmfth42nf3k62eczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhu64gl" />
    <content type="html">
      Learn: Producer-consumer by hand&lt;br/&gt;&lt;br/&gt;The classic whiteboard version uses a queue and Monitor. The consumer waits while the queue is empty; the producer wakes it after adding.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var q = new Queue&amp;lt;int&amp;gt;(); var sync = new object();&lt;br/&gt;var consumer = new Thread(() =&amp;gt; { for (int n = 0; n &amp;lt; 3; n&#43;&#43;) Console.WriteLine(Take()); });&lt;br/&gt;consumer.Start();&lt;br/&gt;for (int i = 1; i &amp;lt;= 3; i&#43;&#43;) lock (sync) { q.Enqueue(i); Monitor.PulseAll(sync); } // wake the consumer&lt;br/&gt;consumer.Join();&lt;br/&gt;int Take()&lt;br/&gt;{&lt;br/&gt;    lock (sync) { while (q.Count == 0) Monitor.Wait(sync); return q.Dequeue(); } // Wait releases the lock&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1, 2, 3. Wait must sit in a while loop: re-check after waking. In real code, BlockingCollection or Channel&amp;lt;T&amp;gt; do this for you.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/api/system.threading.monitor.wait&#34;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.threading.monitor.wait&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-088
    </content>
    <updated>2026-10-02T11:37:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs9lk9kr2t90gv7hx9r846f6702jwxhvd659mkte4xr0kvuqqq45vszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3mssd8</id>
    
      <title type="html">Learn: Protecting endpoints in ASP.NET Core Order matters: ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs9lk9kr2t90gv7hx9r846f6702jwxhvd659mkte4xr0kvuqqq45vszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3mssd8" />
    <content type="html">
      Learn: Protecting endpoints in ASP.NET Core&lt;br/&gt;&lt;br/&gt;Order matters: UseRouting, then UseCors, then UseAuthentication, then UseAuthorization.&lt;br/&gt;[Authorize] requires a logged-in user; [AllowAnonymous] opens one action again.&lt;br/&gt;[Authorize(Roles = &amp;#34;Admin,Billing&amp;#34;)] means Admin OR Billing; two separate [Authorize] attributes mean both must pass. A policy ([Authorize(Policy = &amp;#34;Over18&amp;#34;)]) is a named set of requirements, each checked by a handler.&lt;br/&gt;Web apps usually log in with a cookie; APIs usually use a JWT bearer token.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/aspnet/core/security/authorization/introduction&#34;&gt;https://learn.microsoft.com/en-us/aspnet/core/security/authorization/introduction&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-084
    </content>
    <updated>2026-10-02T11:07:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs04mew4jz9s8ckyjh8y4e3zkt2pah596da4qupfmzpu0uujt088kgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jm8eu8r</id>
    
      <title type="html">Question: The inner loop starts at j = i, so it gets shorter each ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs04mew4jz9s8ckyjh8y4e3zkt2pah596da4qupfmzpu0uujt088kgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jm8eu8r" />
    <content type="html">
      Question: The inner loop starts at j = i, so it gets shorter each time. Is this still O(n²)?&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int n = 10, steps = 0;&lt;br/&gt;for (int i = 0; i &amp;lt; n; i&#43;&#43;)&lt;br/&gt;    for (int j = i; j &amp;lt; n; j&#43;&#43;) steps&#43;&#43;;&lt;br/&gt;Console.WriteLine(steps);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big008 · BIG-008-Q1
    </content>
    <updated>2026-10-02T10:07:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs8ss5m8ns9sdwkyfr25fndpgpvtlunxxzthlf2j4nnauu60gs2zwczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnn3j4a</id>
    
      <title type="html">Yes. The inner loop runs n, then n - 1, ... down to 1 times. That ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8ss5m8ns9sdwkyfr25fndpgpvtlunxxzthlf2j4nnauu60gs2zwczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnn3j4a" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs04mew4jz9s8ckyjh8y4e3zkt2pah596da4qupfmzpu0uujt088kgpz3mhxue69uhhyetvv9ujuerpd46hxtnfdu74733k&#39;&gt;nevent1q…733k&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Yes. The inner loop runs n, then n - 1, ... down to 1 times. That is n(n &#43; 1)/2 in total: about half of n².&lt;br/&gt;&lt;br/&gt;Big-O drops the constant 1/2, so it is O(n²). For n = 10 it prints 55.&lt;br/&gt;&lt;br/&gt;#big008 · BIG-008-A1
    </content>
    <updated>2026-10-02T10:07:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsy2fsjnguzmq765yzk2943ur8v3t9cpfzdfpdtjdgartkcumsgwhszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jq3u34q</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsy2fsjnguzmq765yzk2943ur8v3t9cpfzdfpdtjdgartkcumsgwhszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jq3u34q" />
    <content type="html">
      Learn: Sharding splits data by a key&lt;br/&gt;&lt;br/&gt;When one database is too big or too busy, split the data across several databases (shards), for example by user ID.&lt;br/&gt;&lt;br/&gt;The risk is a hot shard: if one key gets most of the traffic, one shard does most of the work. Choose a key that spreads load evenly.&lt;br/&gt;&lt;br/&gt;#tip · TIP-016
    </content>
    <updated>2026-10-02T09:07:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs20qpff74l72tlzms004a452z98nhyp0hckxyuqd0s54zg3rjk72czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj9akvx</id>
    
      <title type="html">Count the letters. Add 1 for each letter of the first string, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs20qpff74l72tlzms004a452z98nhyp0hckxyuqd0s54zg3rjk72czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj9akvx" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsp2c67c2rfcy4zc0uqamqduax674zhr63gvj5fm37hfu6c00txncqpz3mhxue69uhhyetvv9ujuerpd46hxtnfdu83guv0&#39;&gt;nevent1q…guv0&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Count the letters. Add 1 for each letter of the first string, subtract 1 for each letter of the second. If a count goes below zero, the answer is false.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(IsPermutation(&amp;#34;listen&amp;#34;, &amp;#34;silent&amp;#34;));&lt;br/&gt;Console.WriteLine(IsPermutation(&amp;#34;apple&amp;#34;, &amp;#34;plead&amp;#34;));&lt;br/&gt;static bool IsPermutation(string s, string t)&lt;br/&gt;{&lt;br/&gt;    if (s.Length != t.Length) return false;&lt;br/&gt;    var counts = new Dictionary&amp;lt;char, int&amp;gt;();&lt;br/&gt;    foreach (char c in s) counts[c] = counts.GetValueOrDefault(c) &#43; 1;&lt;br/&gt;    foreach (char c in t) if ((counts[c] = counts.GetValueOrDefault(c) - 1) &amp;lt; 0) return false;&lt;br/&gt;    return true;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True, then False.&lt;br/&gt;&lt;br/&gt;Time O(n), one pass over each string. Extra memory: one count per different letter.&lt;br/&gt;&lt;br/&gt;#arr006 · ARR-006-A1
    </content>
    <updated>2026-10-02T08:07:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsp2c67c2rfcy4zc0uqamqduax674zhr63gvj5fm37hfu6c00txncqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5ka5qh</id>
    
      <title type="html">Question: One string is a permutation of another if it has the ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsp2c67c2rfcy4zc0uqamqduax674zhr63gvj5fm37hfu6c00txncqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5ka5qh" />
    <content type="html">
      Question: One string is a permutation of another if it has the same letters in a different order, like &amp;#34;listen&amp;#34; and &amp;#34;silent&amp;#34;.&lt;br/&gt;&lt;br/&gt;How do you check this in O(n)?&lt;br/&gt;&lt;br/&gt;(CtCI 1.2)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr006 · ARR-006-Q1
    </content>
    <updated>2026-10-02T08:07:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0jk8jjas7kp8zldqtyxgdq8hlsnvhrysdhxtkk6rfk33wwctjs9qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jf77a5r</id>
    
      <title type="html">Learn: Tree What: nodes in a hierarchy. One root at the top, each ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0jk8jjas7kp8zldqtyxgdq8hlsnvhrysdhxtkk6rfk33wwctjs9qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jf77a5r" />
    <content type="html">
      Learn: Tree&lt;br/&gt;&lt;br/&gt;What: nodes in a hierarchy. One root at the top, each node has children, nodes with no children are leaves.&lt;br/&gt;Use it when: data is nested: folders, HTML, company org charts, menus, and database indexes.&lt;br/&gt;Most tree problems are recursion: solve for the children, then combine.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var root = new Tree(1, new Tree(2, null, null), new Tree(3, new Tree(4, null, null), null));&lt;br/&gt;Console.WriteLine(Count(root));&lt;br/&gt;&lt;br/&gt;static int Count(Tree? t) =&amp;gt; t == null ? 0 : 1 &#43; Count(t.Left) &#43; Count(t.Right);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 4: the number of nodes.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/tree-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/tree-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-030
    </content>
    <updated>2026-10-02T07:07:41Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs2jfnxg2c3kuelft59qq9dx0trzduv29tsfnc0effzwk8teddz0jgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr2tgdl</id>
    
      <title type="html">Learn: OAuth 2.0 vs OpenID Connect OAuth 2.0 is about access: it ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs2jfnxg2c3kuelft59qq9dx0trzduv29tsfnc0effzwk8teddz0jgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr2tgdl" />
    <content type="html">
      Learn: OAuth 2.0 vs OpenID Connect&lt;br/&gt;&lt;br/&gt;OAuth 2.0 is about access: it lets an app call an API for the user, with an access token.&lt;br/&gt;OpenID Connect (OIDC) adds login on top: an ID token that says who the user is.&lt;br/&gt;The usual flow for web and mobile apps is the authorization code flow with PKCE: the user logs in at the identity provider, the app gets a code, and swaps it for tokens.&lt;br/&gt;Short version: access token → for the API; ID token → for the app, to know who logged in.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/entra/identity-platform/v2-protocols-oidc&#34;&gt;https://learn.microsoft.com/en-us/entra/identity-platform/v2-protocols-oidc&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-093
    </content>
    <updated>2026-10-02T06:37:31Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsw9gxgpdhsudlvhxx6jevlmh5utewlmpx05qkjmlda65rk6vxngvszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3e0xgf</id>
    
      <title type="html">Question: Write a function that tells whether all the characters ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsw9gxgpdhsudlvhxx6jevlmh5utewlmpx05qkjmlda65rk6vxngvszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3e0xgf" />
    <content type="html">
      Question: Write a function that tells whether all the characters in a string are different. &amp;#34;abcde&amp;#34; gives true. &amp;#34;hello&amp;#34; gives false, because it has two l&amp;#39;s.&lt;br/&gt;&lt;br/&gt;What is the time complexity of your idea?&lt;br/&gt;&lt;br/&gt;(CtCI 1.1)&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr005 · ARR-005-Q1
    </content>
    <updated>2026-10-02T06:07:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqspc37w3gf9j8lp0l745qhkhpx95z7yktegu96zevkm6x2ad55rklgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j50t90v</id>
    
      <title type="html">One pass with a HashSet. Add each character. If Add returns ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqspc37w3gf9j8lp0l745qhkhpx95z7yktegu96zevkm6x2ad55rklgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j50t90v" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsw9gxgpdhsudlvhxx6jevlmh5utewlmpx05qkjmlda65rk6vxngvspz3mhxue69uhhyetvv9ujuerpd46hxtnfdu4hgayh&#39;&gt;nevent1q…gayh&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;One pass with a HashSet. Add each character. If Add returns false, that character was already in the set, so the answer is false.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(AllUnique(&amp;#34;abcde&amp;#34;));&lt;br/&gt;Console.WriteLine(AllUnique(&amp;#34;hello&amp;#34;));&lt;br/&gt;&lt;br/&gt;static bool AllUnique(string s)&lt;br/&gt;{&lt;br/&gt;    var seen = new HashSet&amp;lt;char&amp;gt;();&lt;br/&gt;    foreach (char c in s)&lt;br/&gt;        if (!seen.Add(c)) return false; // Add returns false for a repeat&lt;br/&gt;    return true;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True, then False.&lt;br/&gt;&lt;br/&gt;Time: O(n) on average, one pass, and each Add is O(1) on average. Extra memory: one entry per different character.&lt;br/&gt;&lt;br/&gt;#arr005 · ARR-005-A1
    </content>
    <updated>2026-10-02T06:07:19Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqs0h58u420trukqwxvr4y9l9w8exgwdahcrvez8deqx554u9jg5v5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7nh95v</id>
    
      <title type="html">Learn: Kubernetes in one page Pods, deployments, services and ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs0h58u420trukqwxvr4y9l9w8exgwdahcrvez8deqx554u9jg5v5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7nh95v" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvvjqxgcryd3dxycz6vpj2scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rss0qu8w&#39;&gt;naddr1qq…qu8w&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Kubernetes in one page&lt;br/&gt;&lt;br/&gt;Pods, deployments, services and scaling: the Kubernetes words interviewers expect you to know.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crvvjqxgcryd3dxycz6vpj2scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu6005qf&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…05qf&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;kubernetes-in-one-page-5&#34;&gt;Kubernetes in one page&lt;/h2&gt;

&lt;p&gt;Kubernetes (K8s) runs containers on a group of machines (a &lt;strong&gt;cluster&lt;/strong&gt;) and keeps them in the state you describe.&lt;/p&gt;

&lt;h3 id=&#34;the-main-objects-5&#34;&gt;The main objects&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pod:&lt;/strong&gt; the smallest unit. One or more containers that run together and share a network address.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deployment:&lt;/strong&gt; &amp;#34;keep 3 copies of this pod running, with this image.&amp;#34; Change the image and it rolls out new pods step by step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service:&lt;/strong&gt; one stable name and address in front of a changing group of pods, with load balancing between them.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ingress:&lt;/strong&gt; routes outside HTTP traffic (like &lt;code&gt;api.example.com/orders&lt;/code&gt;) to services.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ConfigMap and Secret:&lt;/strong&gt; configuration and passwords given to pods without rebuilding the image. A Secret is only base64-encoded by default, not encrypted, so limit who can read it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;what-it-does-for-you-5&#34;&gt;What it does for you&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Self-healing:&lt;/strong&gt; restarts containers that crash, replaces unhealthy ones, and only sends traffic to pods that pass their readiness check.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scaling:&lt;/strong&gt; change the number of copies, or let a Horizontal Pod Autoscaler add pods when CPU goes up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rolling updates:&lt;/strong&gt; new versions go out gradually and can be rolled back.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;you-describe-it-makes-it-true-5&#34;&gt;You describe, it makes it true&lt;/h3&gt;

&lt;p&gt;You write the &lt;strong&gt;desired state&lt;/strong&gt; in YAML (for example, 3 replicas). Kubernetes keeps comparing what runs with what you asked for, and fixes any difference.&lt;/p&gt;

&lt;h3 id=&#34;interview-tips-5&#34;&gt;Interview tips&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Know the difference between a &lt;strong&gt;Pod&lt;/strong&gt; (instance), a &lt;strong&gt;Deployment&lt;/strong&gt; (keeps copies running) and a &lt;strong&gt;Service&lt;/strong&gt; (stable address).&lt;/li&gt;
&lt;li&gt;Health checks matter: a &lt;strong&gt;liveness&lt;/strong&gt; probe restarts a stuck container; a &lt;strong&gt;readiness&lt;/strong&gt; probe keeps traffic away until it is ready.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://roadmap.sh/kubernetes&#34;&gt;https://roadmap.sh/kubernetes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-062&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-062
    </content>
    <updated>2026-10-02T05:37:20Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsqvwkfnm044f93u2usej4tsvg7l0nqvenslsg7nyatlu28dz26n2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyullqd</id>
    
      <title type="html">Learn: Linked list What: nodes, each holding a value and a link ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsqvwkfnm044f93u2usej4tsvg7l0nqvenslsg7nyatlu28dz26n2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyullqd" />
    <content type="html">
      Learn: Linked list&lt;br/&gt;&lt;br/&gt;What: nodes, each holding a value and a link to the next node.&lt;br/&gt;Cost: insert or remove at a node you already hold is O(1); reaching item k is O(k), because you must walk.&lt;br/&gt;Use it when: you add and remove at the ends or in the middle a lot, and rarely jump to a position. Example: an LRU cache, which pairs a Dictionary (find a node fast) with a linked list (move it to the front).&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var list = new LinkedList&amp;lt;int&amp;gt;();&lt;br/&gt;list.AddLast(2); list.AddLast(3); list.AddFirst(1);&lt;br/&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, list));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 2 3. .NET&amp;#39;s LinkedList&amp;lt;T&amp;gt; is doubly linked. In practice List&amp;lt;T&amp;gt; is often faster, because its items sit next to each other in memory.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/linked-list-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/linked-list-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-026
    </content>
    <updated>2026-10-02T05:07:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqstufx5kk0pjmy07x4rpk5avhpsggxnssve3uk0892cq3y4tujxcdszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j67akhy</id>
    
      <title type="html">Learn: Merge sort, step by step How merge sort splits, sorts and ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqstufx5kk0pjmy07x4rpk5avhpsggxnssve3uk0892cq3y4tujxcdszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j67akhy" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vp32serzvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsvnyzdv&#39;&gt;naddr1qq…yzdv&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Merge sort, step by step&lt;br/&gt;&lt;br/&gt;How merge sort splits, sorts and merges; why it is O(n log n); and when to choose it.&lt;br/&gt;&lt;br/&gt;Read the full article:&lt;blockquote class=&#34;border-l-05rem border-l-strongpink border-solid&#34;&gt;&lt;div class=&#34;-ml-4 bg-gradient-to-r from-gray-100 dark:from-zinc-800 to-transparent mr-0 mt-0 mb-4 pl-4 pr-2 py-2&#34;&gt;quoting  &lt;span itemprop=&#34;mentions&#34; itemscope itemtype=&#34;https://schema.org/Article&#34;&gt;&lt;a itemprop=&#34;url&#34; href=&#34;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vp32serzvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gufh5cwh&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…5cwh&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;merge-sort-step-by-step-2&#34;&gt;Merge sort, step by step&lt;/h2&gt;

&lt;p&gt;Merge sort is the classic &lt;strong&gt;divide and conquer&lt;/strong&gt; sort.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Divide:&lt;/strong&gt; split the array into two halves.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conquer:&lt;/strong&gt; sort each half, with merge sort again (recursion).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Combine:&lt;/strong&gt; merge the two sorted halves into one sorted array.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An array of one item is already sorted, so the recursion stops there.&lt;/p&gt;

&lt;h3 id=&#34;the-code-2&#34;&gt;The code&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;Console.WriteLine(string.Join(&amp;#34; &amp;#34;, Sort(new[] { 5, 2, 9, 1, 6 })));
static int[] Sort(int[] a)
{
    if (a.Length &amp;lt;= 1) return a;
    int[] left = Sort(a[..(a.Length / 2)]), right = Sort(a[(a.Length / 2)..]); // split in half
    var result = new List&amp;lt;int&amp;gt;(); int i = 0, j = 0;
    while (i &amp;lt; left.Length &amp;amp;&amp;amp; j &amp;lt; right.Length) result.Add(left[i] &amp;lt;= right[j] ? left[i&#43;&#43;] : right[j&#43;&#43;]);
    result.AddRange(left[i..]); result.AddRange(right[j..]); // copy what is left
    return result.ToArray();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;1 2 5 6 9&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&#34;merging-2&#34;&gt;Merging&lt;/h3&gt;

&lt;p&gt;Look only at the front of each half and take the smaller item. Repeat until one half is empty, then copy what is left of the other. Using &lt;code&gt;&amp;lt;=&lt;/code&gt; keeps equal items in their original order, so merge sort is &lt;strong&gt;stable&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&#34;cost-5&#34;&gt;Cost&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Time:&lt;/strong&gt; O(n log n) in every case. There are about log n levels of splitting, and each level merges n items in total.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory:&lt;/strong&gt; O(n) extra for the merged arrays.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;when-to-choose-it-2&#34;&gt;When to choose it&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You need a &lt;strong&gt;stable&lt;/strong&gt; sort.&lt;/li&gt;
&lt;li&gt;You sort a &lt;strong&gt;linked list&lt;/strong&gt; (merging needs no random access).&lt;/li&gt;
&lt;li&gt;The data is too big for memory and is sorted in chunks on disk (external sorting).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In everyday C#, &lt;code&gt;Array.Sort&lt;/code&gt; is O(n log n) and the right default, but it is &lt;strong&gt;not stable&lt;/strong&gt;; &lt;code&gt;OrderBy&lt;/code&gt; in LINQ is stable. Know merge sort for interviews and for the cases above.&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/merge-sort/&#34;&gt;https://www.geeksforgeeks.org/dsa/merge-sort/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-037&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-037
    </content>
    <updated>2026-10-01T18:37:32Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsfszqy5txqhyu869fc5vntk4hdh7q8jzgps5vr9s4z5qzxwayjlsszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr92c2p</id>
    
      <title type="html">Learn: Abstract class An abstract class is a base class you ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsfszqy5txqhyu869fc5vntk4hdh7q8jzgps5vr9s4z5qzxwayjlsszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jr92c2p" />
    <content type="html">
      Learn: Abstract class&lt;br/&gt;&lt;br/&gt;An abstract class is a base class you can&amp;#39;t create directly. It can hold shared code and fields, plus abstract members each subclass must fill in.&lt;br/&gt;A class can inherit from only one class.&lt;br/&gt;Use it when: related classes share real code, not just a contract.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Animal[] animals = { new Dog(), new Cat() };&lt;br/&gt;foreach (var a in animals) Console.WriteLine(a.Describe());&lt;br/&gt;&lt;br/&gt;abstract class Animal&lt;br/&gt;{&lt;br/&gt;    public string Describe() =&amp;gt; $&amp;#34;{GetType().Name} says {Sound()}&amp;#34;; // shared code&lt;br/&gt;    protected abstract string Sound();                             // each subclass fills in&lt;br/&gt;}&lt;br/&gt;class Dog : Animal { protected override string Sound() =&amp;gt; &amp;#34;woof&amp;#34;; }&lt;br/&gt;class Cat : Animal { protected override string Sound() =&amp;gt; &amp;#34;meow&amp;#34;; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints Dog says woof, then Cat says meow.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/abstract&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/abstract&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-049
    </content>
    <updated>2026-10-01T18:07:29Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsyf22hhpuqg8gdgpm38645mz8ukz84fhkpl23hakkksd5z38j8knszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmh4m2p</id>
    
      <title type="html">Learn: Value types vs reference types A value type (struct, int, ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsyf22hhpuqg8gdgpm38645mz8ukz84fhkpl23hakkksd5z38j8knszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmh4m2p" />
    <content type="html">
      Learn: Value types vs reference types&lt;br/&gt;&lt;br/&gt;A value type (struct, int, bool, DateTime) holds its data directly; assigning it makes a copy.&lt;br/&gt;A reference type (class, string, arrays) holds a reference; two variables can point to the same object.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var p1 = new PointStruct { X = 1 }; var p2 = p1; p2.X = 9;&lt;br/&gt;var c1 = new PointClass { X = 1 }; var c2 = c1; c2.X = 9;&lt;br/&gt;Console.WriteLine($&amp;#34;{p1.X} {c1.X}&amp;#34;);&lt;br/&gt;&lt;br/&gt;struct PointStruct { public int X; }&lt;br/&gt;class PointClass { public int X; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 1 9: changing the copied struct didn&amp;#39;t touch the original, but both class variables see the change.&lt;br/&gt;Boxing: putting a value type into an object (object o = 5) copies it to the heap. It is slower, so avoid it in hot loops.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-100
    </content>
    <updated>2026-10-01T17:07:21Z</updated>
  </entry>

</feed>