<?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.cloud.vinney.xyz</generator>

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




  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsfsae450r8rcc3urzc6fk0dlzwqqf776usqml2uhru32djfpketpgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6vusrc</id>
    
      <title type="html">Learn: IDisposable and using Some objects hold things the garbage ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsfsae450r8rcc3urzc6fk0dlzwqqf776usqml2uhru32djfpketpgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j6vusrc" />
    <content type="html">
      Learn: IDisposable and using&lt;br/&gt;&lt;br/&gt;Some objects hold things the garbage collector doesn&amp;#39;t manage well: files, network connections, database connections. They implement IDisposable, and you must call Dispose when done.&lt;br/&gt;using does it for you, even if an exception is thrown:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;using (var r = new Resource()) Console.WriteLine(&amp;#34;working&amp;#34;);&lt;br/&gt;Console.WriteLine(&amp;#34;after&amp;#34;);&lt;br/&gt;&lt;br/&gt;class Resource : IDisposable { public void Dispose() =&amp;gt; Console.WriteLine(&amp;#34;cleaned up&amp;#34;); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints working, cleaned up, after.&lt;br/&gt;Shorter form: using var file = File.OpenRead(path); disposes at the end of the method or block.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-101
    </content>
    <updated>2026-10-18T12:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsdkkkcn4t0z5w3y0hffgdmrpkwuncslxn94laz9e59zrxazc2ayyqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnt4pxr</id>
    
      <title type="html">Learn: Decorator Wrap an object in another object of the same ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsdkkkcn4t0z5w3y0hffgdmrpkwuncslxn94laz9e59zrxazc2ayyqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnt4pxr" />
    <content type="html">
      Learn: Decorator&lt;br/&gt;&lt;br/&gt;Wrap an object in another object of the same type that adds behavior before or after it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;INotifier n = new Loud(new Plain());&lt;br/&gt;Console.WriteLine(n.Send(&amp;#34;hi&amp;#34;));&lt;br/&gt;&lt;br/&gt;interface INotifier { string Send(string m); }&lt;br/&gt;class Plain : INotifier { public string Send(string m) =&amp;gt; m; }&lt;br/&gt;class Loud(INotifier inner) : INotifier { public string Send(string m) =&amp;gt; inner.Send(m).ToUpper() &#43; &amp;#34;!&amp;#34;; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints HI!.&lt;br/&gt;You already use it: GZipStream wraps another Stream and adds compression. (ASP.NET Core middleware is a similar wrapping idea, usually called a pipeline.) Use it to add logging, caching or retries without changing the original class.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/decorator-pattern/&#34;&gt;https://www.geeksforgeeks.org/system-design/decorator-pattern/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-055
    </content>
    <updated>2026-10-16T18:37:58Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsv8jv6mgc7x9l6ywsuvfh8er887p5ems530gpxnxdjknlr46gfh7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnuwvhu</id>
    
      <title type="html">Learn: IDisposable and using Some objects hold things the garbage ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsv8jv6mgc7x9l6ywsuvfh8er887p5ems530gpxnxdjknlr46gfh7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnuwvhu" />
    <content type="html">
      Learn: IDisposable and using&lt;br/&gt;&lt;br/&gt;Some objects hold things the garbage collector doesn&amp;#39;t manage well: files, network connections, database connections. They implement IDisposable, and you must call Dispose when done.&lt;br/&gt;using does it for you, even if an exception is thrown:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;using (var r = new Resource()) Console.WriteLine(&amp;#34;working&amp;#34;);&lt;br/&gt;Console.WriteLine(&amp;#34;after&amp;#34;);&lt;br/&gt;&lt;br/&gt;class Resource : IDisposable { public void Dispose() =&amp;gt; Console.WriteLine(&amp;#34;cleaned up&amp;#34;); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints working, cleaned up, after.&lt;br/&gt;Shorter form: using var file = File.OpenRead(path); disposes at the end of the method or block.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-101
    </content>
    <updated>2026-10-16T18:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs8344h0js7rvtaq5e508x9j7vsqafj303fl68w38f8hp3w6lhywvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jprvl6x</id>
    
      <title type="html">Learn: Repository and Unit of Work Repository: hides data access ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs8344h0js7rvtaq5e508x9j7vsqafj303fl68w38f8hp3w6lhywvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jprvl6x" />
    <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-16T17:38:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqgf86jj3naypu3g6kdvhaz2h49ldn6gtvm0wcsuxhmch6suz6vpqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j05lkul</id>
    
      <title type="html">Learn: JWT in one post A normal JSON Web Token (JWS) has three ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsqgf86jj3naypu3g6kdvhaz2h49ldn6gtvm0wcsuxhmch6suz6vpqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j05lkul" />
    <content type="html">
      Learn: JWT in one post&lt;br/&gt;&lt;br/&gt;A normal JSON Web Token (JWS) has three parts: header.payload.signature, each base64url-encoded. The payload holds claims (user id, roles, expiry).&lt;br/&gt;It is signed, not encrypted: anyone can read it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;string part = Base64Url.EncodeToString(Encoding.UTF8.GetBytes(&amp;#34;{\&amp;#34;sub\&amp;#34;:\&amp;#34;ann\&amp;#34;,\&amp;#34;role\&amp;#34;:\&amp;#34;admin\&amp;#34;}&amp;#34;));&lt;br/&gt;Console.WriteLine(part);&lt;br/&gt;Console.WriteLine(Encoding.UTF8.GetString(Base64Url.DecodeFromChars(part)));&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints the encoded part, then the plain JSON. Never put secrets in a token. The signature proves who issued it and that nobody changed it. Keep access tokens short-lived (for example 1 hour) and use refresh tokens for longer sessions.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/aspnet/core/security/authentication/&#34;&gt;https://learn.microsoft.com/en-us/aspnet/core/security/authentication/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-085
    </content>
    <updated>2026-10-16T17:07:58Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs8far6wds4m2n3trhv43x5dv30e75qnnc2wdw0u8wta5qu53ktrcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmgs8vu</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.cloud.vinney.xyz/nevent1qqs8far6wds4m2n3trhv43x5dv30e75qnnc2wdw0u8wta5qu53ktrcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmgs8vu" />
    <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-16T16:38:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsyw2p2f8flgsps35wllwgunludqquqtx447m4pyxmc5cjwmxpnpwszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju0tkpu</id>
    
      <title type="html">Learn: Strings What: a sequence of characters. In C# a string ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsyw2p2f8flgsps35wllwgunludqquqtx447m4pyxmc5cjwmxpnpwszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju0tkpu" />
    <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-16T16:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgygt8wajvp09ejzc5mrm92j8n0du3kn97fjq9n7y9r4ys9xff6gszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9u8f3h</id>
    
      <title type="html">Learn: The Lock type (.NET 9&#43;) .NET 9 added ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgygt8wajvp09ejzc5mrm92j8n0du3kn97fjq9n7y9r4ys9xff6gszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9u8f3h" />
    <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-16T15:38:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsg7kjth3kjd0pl6wxjz0agtjp95gzzd5z6859y4fn8p72jfjzuszgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlawy86</id>
    
      <title type="html">Learn: Prefix sums, where to use them What: prefix[i] = the sum ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsg7kjth3kjd0pl6wxjz0agtjp95gzzd5z6859y4fn8p72jfjzuszgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlawy86" />
    <content type="html">
      Learn: Prefix sums, where to use them&lt;br/&gt;&lt;br/&gt;What: prefix[i] = the sum of the first i items. Build it once in O(n); then any range sum is one subtraction.&lt;br/&gt;Use it when: you answer many &amp;#34;sum from i to j&amp;#34; questions, or look for subarrays with a given sum (together with a Dictionary). It also works in 2D for grids.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 3, 1, 4, 1, 5 };&lt;br/&gt;var prefix = new int[a.Length &#43; 1];&lt;br/&gt;for (int i = 0; i &amp;lt; a.Length; i&#43;&#43;) prefix[i &#43; 1] = prefix[i] &#43; a[i];&lt;br/&gt;Console.WriteLine(prefix[4] - prefix[1]); // a[1] &#43; a[2] &#43; a[3]&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 6: 1 &#43; 4 &#43; 1.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/prefix-sum-array-implementation-applications-competitive-programming/&#34;&gt;https://www.geeksforgeeks.org/dsa/prefix-sum-array-implementation-applications-competitive-programming/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-040
    </content>
    <updated>2026-10-16T15:08:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswyj7xtr05ptmxh6hdj5nqkgg3xzyqsy9cfgdwncy25kkhkfcu4rczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38junyp7z</id>
    
      <title type="html">Learn: Binary search in one post On a sorted array, look at the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswyj7xtr05ptmxh6hdj5nqkgg3xzyqsy9cfgdwncy25kkhkfcu4rczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38junyp7z" />
    <content type="html">
      Learn: Binary search in one post&lt;br/&gt;&lt;br/&gt;On a sorted array, look at the middle. If the target is bigger, keep the right half; if smaller, the left half. Each step halves the range: O(log n).&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 3, 5, 7, 9, 11 };&lt;br/&gt;int target = 7, lo = 0, hi = a.Length - 1;&lt;br/&gt;while (lo &amp;lt;= hi)&lt;br/&gt;{&lt;br/&gt;    int mid = lo &#43; (hi - lo) / 2;&lt;br/&gt;    if (a[mid] == target) { Console.WriteLine(mid); break; }&lt;br/&gt;    if (a[mid] &amp;lt; target) lo = mid &#43; 1; else hi = mid - 1;&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 3. Write mid as lo &#43; (hi - lo) / 2: plain (lo &#43; hi) / 2 can overflow an int on huge arrays.&lt;br/&gt;&lt;br/&gt;#tip · TIP-006
    </content>
    <updated>2026-10-16T14:37:59Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs0g00nnrjqqfj0smhq497jdxp948djv9ztjffdvuwjv3jf2uhzpjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jccwa7l</id>
    
      <title type="html">Learn: Scale up or scale out Scale up (vertical): a bigger ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs0g00nnrjqqfj0smhq497jdxp948djv9ztjffdvuwjv3jf2uhzpjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jccwa7l" />
    <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-16T14:08:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqspemrtk28cvshk6xgsq7r7kjvp0hnjzxhutk6et65kuzdmv6egw5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jpw2sr3</id>
    
      <title type="html">Learn: Divide and conquer The pattern: split the problem into ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqspemrtk28cvshk6xgsq7r7kjvp0hnjzxhutk6et65kuzdmv6egw5czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jpw2sr3" />
    <content type="html">
      Learn: Divide and conquer&lt;br/&gt;&lt;br/&gt;The pattern: split the problem into smaller parts of the same kind, solve each part (usually with recursion), then combine the answers.&lt;br/&gt;&lt;br/&gt;Examples: merge sort (split, sort halves, merge), quick sort, binary search (keep only one half).&lt;br/&gt;&lt;br/&gt;Why it helps: splitting in half again and again gives about log n levels, which is where the &amp;#34;log n&amp;#34; in O(n log n) comes from.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/divide-and-conquer/&#34;&gt;https://www.geeksforgeeks.org/dsa/divide-and-conquer/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-036
    </content>
    <updated>2026-10-16T13:38:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqv878lju0um0ffht2zjvfuce8uaup7kfvcm2en6vvjzxnpcwp4lqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtguhej</id>
    
      <title type="html">Learn: Data structures: which one when? A one-page cheat sheet: ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsqv878lju0um0ffht2zjvfuce8uaup7kfvcm2en6vvjzxnpcwp4lqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtguhej" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vfk2scnvvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsg2xnaa&#39;&gt;naddr1qq…xnaa&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;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vfk2scnvvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gutk3ppj&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…3ppj&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-16T13:08:12Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsg7408ndzwk2eugf4kax5ztpgzmp78pc2mge6tyg2xkeyrfpsju0gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp5mjs3</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsg7408ndzwk2eugf4kax5ztpgzmp78pc2mge6tyg2xkeyrfpsju0gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp5mjs3" />
    <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-16T12:38:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgae6m8kjmql204mvyafrzsmu7zru7l4mpudhr6z3yn6w0lthl24szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhy7j4p</id>
    
      <title type="html">Learn: The lock statement lock lets only one thread at a time run ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgae6m8kjmql204mvyafrzsmu7zru7l4mpudhr6z3yn6w0lthl24szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhy7j4p" />
    <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-16T12:08:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsf9v03m6kxcf7hrahr6edg89xcvjhgg8u262e3mrdz6krf8aspxyqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvumx07</id>
    
      <title type="html">Learn: Hashing What: a hash function turns a key into a number ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsf9v03m6kxcf7hrahr6edg89xcvjhgg8u262e3mrdz6krf8aspxyqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvumx07" />
    <content type="html">
      Learn: Hashing&lt;br/&gt;&lt;br/&gt;What: a hash function turns a key into a number that picks a bucket, so a lookup jumps straight to the right place.&lt;br/&gt;Cost: insert, find and delete are O(1) on average; many collisions can slow them down.&lt;br/&gt;Use it when: you look things up by key, count things, remove duplicates, or cache results.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var counts = new Dictionary&amp;lt;string, int&amp;gt;();&lt;br/&gt;foreach (var w in &amp;#34;to be or not to be&amp;#34;.Split(&amp;#39; &amp;#39;))&lt;br/&gt;    counts[w] = counts.GetValueOrDefault(w) &#43; 1;&lt;br/&gt;Console.WriteLine(counts[&amp;#34;be&amp;#34;]);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 2. In C#: Dictionary&amp;lt;K, V&amp;gt; and HashSet&amp;lt;T&amp;gt;.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/hashing-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/hashing-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-024
    </content>
    <updated>2026-10-16T11:37:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsygp5jmjw5ejcej8x3enfacjjwprs4est64ndcc2qku3ffe2rqjrqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjr8w97</id>
    
      <title type="html">Learn: Bitwise tricks Operators: &amp;amp; (and), | (or), ^ (xor), ~ ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsygp5jmjw5ejcej8x3enfacjjwprs4est64ndcc2qku3ffe2rqjrqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjr8w97" />
    <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-16T11:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs847g5qag8c4nk6xtc49gmkn6hdwzncv2gd4ytcmm62vj3k49wzcczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj3esgh</id>
    
      <title type="html">Learn: What a load balancer does It spreads incoming requests ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs847g5qag8c4nk6xtc49gmkn6hdwzncv2gd4ytcmm62vj3k49wzcczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj3esgh" />
    <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-16T10:38:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqspp6se4pm8dz8tthva5xmzunlp5lq2gwc2kt7y6euw4e8hffla2uczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvkpmtz</id>
    
      <title type="html">Learn: Decorator Wrap an object in another object of the same ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqspp6se4pm8dz8tthva5xmzunlp5lq2gwc2kt7y6euw4e8hffla2uczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvkpmtz" />
    <content type="html">
      Learn: Decorator&lt;br/&gt;&lt;br/&gt;Wrap an object in another object of the same type that adds behavior before or after it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;INotifier n = new Loud(new Plain());&lt;br/&gt;Console.WriteLine(n.Send(&amp;#34;hi&amp;#34;));&lt;br/&gt;&lt;br/&gt;interface INotifier { string Send(string m); }&lt;br/&gt;class Plain : INotifier { public string Send(string m) =&amp;gt; m; }&lt;br/&gt;class Loud(INotifier inner) : INotifier { public string Send(string m) =&amp;gt; inner.Send(m).ToUpper() &#43; &amp;#34;!&amp;#34;; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints HI!.&lt;br/&gt;You already use it: GZipStream wraps another Stream and adds compression. (ASP.NET Core middleware is a similar wrapping idea, usually called a pipeline.) Use it to add logging, caching or retries without changing the original class.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/decorator-pattern/&#34;&gt;https://www.geeksforgeeks.org/system-design/decorator-pattern/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-055
    </content>
    <updated>2026-10-16T10:07:57Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs0d7y953uaq72y5wvmp0e4rh9zymlvmc7p5z70ss3uc90ctq3grkczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsvxz9l</id>
    
      <title type="html">Learn: Mutex A Mutex is a lock that can also work across ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs0d7y953uaq72y5wvmp0e4rh9zymlvmc7p5z70ss3uc90ctq3grkczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsvxz9l" />
    <content type="html">
      Learn: Mutex&lt;br/&gt;&lt;br/&gt;A Mutex is a lock that can also work across processes when you give it a name. Example: allow only one copy of your app to run.&lt;br/&gt;It has thread affinity (it belongs to one thread): only the thread that took it can release it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var m = new Mutex();&lt;br/&gt;m.WaitOne();&lt;br/&gt;var t = new Thread(() =&amp;gt;&lt;br/&gt;{&lt;br/&gt;    try { m.ReleaseMutex(); } catch (ApplicationException) { Console.WriteLine(&amp;#34;only the owner can release&amp;#34;); }&lt;br/&gt;});&lt;br/&gt;t.Start(); t.Join();&lt;br/&gt;m.ReleaseMutex();&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints only the owner can release. Don&amp;#39;t hold a Mutex across await: the code after it may run on another thread, which can&amp;#39;t release it. Without a name, use lock instead: it is much faster.&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-076
    </content>
    <updated>2026-10-16T09:38:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsr89hu6ym62c4kkxs93nx3rlgscr2mw3zzq8e3humazen3v83uq0gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhpd0x0</id>
    
      <title type="html">Learn: volatile Without it, the compiler or CPU may keep reusing ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsr89hu6ym62c4kkxs93nx3rlgscr2mw3zzq8e3humazen3v83uq0gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhpd0x0" />
    <content type="html">
      Learn: volatile&lt;br/&gt;&lt;br/&gt;Without it, the compiler or CPU may keep reusing an old read of a field, so a loop can miss a &amp;#34;stop&amp;#34; flag that another thread set. volatile makes every read and write go to the field itself (the compiler can&amp;#39;t keep an old copy), and limits how those reads and writes are reordered.&lt;br/&gt;What it doesn&amp;#39;t do: make count&#43;&#43; safe (use Interlocked or lock), or guarantee the very latest value on every processor.&lt;br/&gt;For stopping work, prefer a CancellationToken.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/volatile&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/volatile&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-090
    </content>
    <updated>2026-10-16T09:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsg6wjyeynyxv087p6lqftgd7gjfjr0cvzwxmzl0npdpxu2g09dyvgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxtafjz</id>
    
      <title type="html">Learn: Sliding window that grows and shrinks Most interview ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsg6wjyeynyxv087p6lqftgd7gjfjr0cvzwxmzl0npdpxu2g09dyvgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxtafjz" />
    <content type="html">
      Learn: Sliding window that grows and shrinks&lt;br/&gt;&lt;br/&gt;Most interview windows have no fixed size. Grow the window with right. For the longest window, shrink from left while it breaks the rule. For the shortest, shrink while it still meets the goal.&lt;br/&gt;Example: the shortest run of numbers with a sum of at least 8.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int[] a = { 1, 4, 2, 2, 5, 1 };&lt;br/&gt;int target = 8, left = 0, sum = 0, best = int.MaxValue;&lt;br/&gt;for (int right = 0; right &amp;lt; a.Length; right&#43;&#43;)&lt;br/&gt;{&lt;br/&gt;    sum &#43;= a[right];&lt;br/&gt;    while (sum &amp;gt;= target) { best = Math.Min(best, right - left &#43; 1); sum -= a[left&#43;&#43;]; }&lt;br/&gt;}&lt;br/&gt;Console.WriteLine(best);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 3 (2 &#43; 2 &#43; 5, or 4 &#43; 2 &#43; 2). O(n): each index moves forward only.&lt;br/&gt;This sum trick needs non-negative numbers. If no window reaches the target, best stays int.MaxValue: report &amp;#34;none&amp;#34;.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/window-sliding-technique/&#34;&gt;https://www.geeksforgeeks.org/dsa/window-sliding-technique/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-066
    </content>
    <updated>2026-10-16T08:37:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswzk9ap38e5thfwvepasqafwlj4q6h0t5exhwtzx3rz8rezesllcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j2jg0a9</id>
    
      <title type="html">Learn: Deadlock Thread 1 holds lock A and waits for B. Thread 2 ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswzk9ap38e5thfwvepasqafwlj4q6h0t5exhwtzx3rz8rezesllcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j2jg0a9" />
    <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-16T08:08:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsylpq5mm7lxekfum4540z5wu2mwv92d2p840jpmqdvvppdpnwjzlqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsk6vmu</id>
    
      <title type="html">Learn: Factory A factory creates objects for you, so the caller ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsylpq5mm7lxekfum4540z5wu2mwv92d2p840jpmqdvvppdpnwjzlqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jsk6vmu" />
    <content type="html">
      Learn: Factory&lt;br/&gt;&lt;br/&gt;A factory creates objects for you, so the caller asks for &amp;#34;a pdf exporter&amp;#34; without naming the class.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(Create(&amp;#34;pdf&amp;#34;).Export());&lt;br/&gt;static IExporter Create(string kind) =&amp;gt; kind switch&lt;br/&gt;{&lt;br/&gt;    &amp;#34;pdf&amp;#34; =&amp;gt; new PdfExporter(),&lt;br/&gt;    &amp;#34;csv&amp;#34; =&amp;gt; new CsvExporter(),&lt;br/&gt;    _ =&amp;gt; throw new ArgumentException(kind),&lt;br/&gt;};&lt;br/&gt;interface IExporter { string Export(); }&lt;br/&gt;class PdfExporter : IExporter { public string Export() =&amp;gt; &amp;#34;PDF file&amp;#34;; }&lt;br/&gt;class CsvExporter : IExporter { public string Export() =&amp;gt; &amp;#34;CSV file&amp;#34;; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints PDF file.&lt;br/&gt;Use it when: which class to create depends on input or configuration, or creating it is complicated.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/factory-method-for-designing-pattern/&#34;&gt;https://www.geeksforgeeks.org/system-design/factory-method-for-designing-pattern/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-052
    </content>
    <updated>2026-10-16T07:38:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszkazh5njxkv9cuwmtvg6cngeeft5qj8q3eq0gwqfdrpzcylqrg6czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnm93xx</id>
    
      <title type="html">Learn: The middleware pipeline Every request passes through a ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszkazh5njxkv9cuwmtvg6cngeeft5qj8q3eq0gwqfdrpzcylqrg6czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jnm93xx" />
    <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-16T07:08:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqspqam6tpwf45uz0d2xa40rezfyfcs9t7w7layl0gu23fnhqc6s7pczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juejyum</id>
    
      <title type="html">Learn: Task vs Thread A Thread is an operating system thread: ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqspqam6tpwf45uz0d2xa40rezfyfcs9t7w7layl0gu23fnhqc6s7pczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juejyum" />
    <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-16T06:38:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs0szdk7k20se5dgqdfyxg5q6x7e73czmklp9xeeg5256syh3h9n5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jknxgzq</id>
    
      <title type="html">Learn: Linked list classic: reverse it Interviewers want your own ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs0szdk7k20se5dgqdfyxg5q6x7e73czmklp9xeeg5256syh3h9n5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jknxgzq" />
    <content type="html">
      Learn: Linked list classic: reverse it&lt;br/&gt;&lt;br/&gt;Interviewers want your own Node class, not LinkedList&amp;lt;T&amp;gt;. Walk the list and point each node back to the one before it. Save the next node first, or you lose the rest of the list.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Node? cur = new Node(1, new Node(2, new Node(3, null))), prev = null;&lt;br/&gt;while (cur != null)&lt;br/&gt;{&lt;br/&gt;    Node? next = cur.Next; // save it before relinking&lt;br/&gt;    cur.Next = prev;&lt;br/&gt;    prev = cur;&lt;br/&gt;    cur = next;&lt;br/&gt;}&lt;br/&gt;Console.WriteLine($&amp;#34;{prev!.Value} {prev.Next!.Value} {prev.Next.Next!.Value}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 3 2 1. O(n) time, O(1) memory.&lt;br/&gt;The other classic: fast and slow pointers (fast moves 2, slow moves 1) find the middle, or detect a cycle when they meet.&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-063
    </content>
    <updated>2026-10-16T06:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswuqsa7fx9t700sztq6k8k7t6pt97rp9nr5rmtflwqm8lkj49px6szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhc0rdm</id>
    
      <title type="html">Learn: Making microservices resilient Timeouts, retries with ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswuqsa7fx9t700sztq6k8k7t6pt97rp9nr5rmtflwqm8lkj49px6szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhc0rdm" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crjw2qxgcryd3dxycz6vfk2scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsd2qdak&#39;&gt;naddr1qq…qdak&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Making microservices resilient&lt;br/&gt;&lt;br/&gt;Timeouts, retries with backoff, circuit breakers, idempotency and the outbox: how services survive each other&amp;#39;s failures.&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;/naddr1qqt4gj2s95crjw2qxgcryd3dxycz6vfk2scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu2ucqcr&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…cqcr&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;making-microservices-resilient-2&#34;&gt;Making microservices resilient&lt;/h2&gt;

&lt;p&gt;In a microservice system, some call always fails somewhere: a service restarts, the network hiccups, a database is slow. Design for these partial failures instead of hoping they don&amp;#39;t happen.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Timeout:&lt;/strong&gt; never wait forever for another service. A slow dependency must not hold your threads and requests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Retry with backoff:&lt;/strong&gt; retry short, temporary failures, waiting longer each time (for example 200 ms, 400 ms, 800 ms) and adding a little randomness (jitter), so many clients don&amp;#39;t retry at the same moment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Circuit breaker:&lt;/strong&gt; after many failures, stop calling the broken service for a while and fail fast. Then try again carefully.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bulkhead:&lt;/strong&gt; limit how many calls can go to one dependency, so one slow service can&amp;#39;t use up everything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fallback:&lt;/strong&gt; return a cached or default answer when a call fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In .NET, &lt;code&gt;Microsoft.Extensions.Http.Resilience&lt;/code&gt; (built on Polly) adds these to &lt;code&gt;HttpClient&lt;/code&gt; in a few lines.&lt;/p&gt;

&lt;h3 id=&#34;a-retry-by-hand-2&#34;&gt;A retry, by hand&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;int calls = 0;
Console.WriteLine(await RetryAsync(() =&amp;gt; &#43;&#43;calls &amp;lt; 3 ? throw new HttpRequestException(&amp;#34;busy&amp;#34;) : Task.FromResult(&amp;#34;ok&amp;#34;)));
async Task&amp;lt;string&amp;gt; RetryAsync(Func&amp;lt;Task&amp;lt;string&amp;gt;&amp;gt; action)
{
    for (int attempt = 1; ; attempt&#43;&#43;)
    {
        try { return await action(); }
        catch (HttpRequestException) when (attempt &amp;lt; 5) { await Task.Delay(10 * (1 &amp;lt;&amp;lt; attempt)); } // wait longer each time
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;ok&lt;/code&gt;: the first two calls fail, the third succeeds, with a growing wait between tries.&lt;/p&gt;

&lt;h3 id=&#34;data-across-services-2&#34;&gt;Data across services&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Idempotency:&lt;/strong&gt; retries mean the same request can arrive twice. Make handlers safe to repeat, for example with a request ID.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Outbox:&lt;/strong&gt; save the business change and the message to send in the same database transaction; a background job publishes the messages. No lost events, but a message may be published twice, so consumers must be idempotent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Saga:&lt;/strong&gt; a business process across services is a series of local steps, each with a compensating step to undo it if a later step fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;at-the-edge-2&#34;&gt;At the edge&lt;/h3&gt;

&lt;p&gt;An &lt;strong&gt;API gateway&lt;/strong&gt; gives clients one entry point and handles routing, authentication and rate limiting for the services behind it.&lt;/p&gt;

&lt;p&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/&#34;&gt;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;#tip · TIP-099&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-099
    </content>
    <updated>2026-10-16T05:38:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsrh6w4crkwqrckzdahflp6xhgcjajszm9h8n9dg6l89adwyrzhqcczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9jtkkd</id>
    
      <title type="html">Learn: The three pattern families Creational: how objects get ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsrh6w4crkwqrckzdahflp6xhgcjajszm9h8n9dg6l89adwyrzhqcczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9jtkkd" />
    <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-16T05:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs2vnd5cx0csdz0v4vc4ggldjpfjm95kvmrrvrmezucau9cqfyk3fszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvv5vnh</id>
    
      <title type="html">Learn: Strategy Put each version of an algorithm behind the same ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs2vnd5cx0csdz0v4vc4ggldjpfjm95kvmrrvrmezucau9cqfyk3fszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvv5vnh" />
    <content type="html">
      Learn: Strategy&lt;br/&gt;&lt;br/&gt;Put each version of an algorithm behind the same shape, and choose one at run time. No growing if/else chain.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Func&amp;lt;decimal, decimal&amp;gt; blackFriday = p =&amp;gt; p * 0.7m;&lt;br/&gt;Console.WriteLine(Checkout(100m, blackFriday));&lt;br/&gt;&lt;br/&gt;static decimal Checkout(decimal price, Func&amp;lt;decimal, decimal&amp;gt; discount) =&amp;gt; discount(price);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 70.0 (decimal keeps one decimal place from 0.7).&lt;br/&gt;In C#, a strategy can be an interface or just a Func. Use it for pricing rules, sorting orders, payment methods.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/strategy-pattern-set-1/&#34;&gt;https://www.geeksforgeeks.org/system-design/strategy-pattern-set-1/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-053
    </content>
    <updated>2026-10-15T18:38:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgd4c4vjsv89ra5pqw8sg73aqpmjdqpr9m6tzkhm45dd86y93tghszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmdesmh</id>
    
      <title type="html">Learn: What log n means log₂ n answers one question: how many ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgd4c4vjsv89ra5pqw8sg73aqpmjdqpr9m6tzkhm45dd86y93tghszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmdesmh" />
    <content type="html">
      Learn: What log n means&lt;br/&gt;&lt;br/&gt;log₂ n answers one question: how many times can you halve n before you reach 1? 8, 4, 2, 1 is 3 halvings, so log₂ 8 = 3.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int n = 1_000_000, steps = 0;&lt;br/&gt;while (n &amp;gt; 1) { n /= 2; steps&#43;&#43;; }&lt;br/&gt;Console.WriteLine(steps);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 19: integer division rounds down, so it counts only full halvings. The exact log₂ of 1,000,000 is about 19.9.&lt;br/&gt;&lt;br/&gt;So O(log n) grows very slowly. Doubling n adds just one step. O(n log n) is often log n rounds of O(n) work each.&lt;br/&gt;&lt;br/&gt;#big006 · BIG-006-N
    </content>
    <updated>2026-10-15T18:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsq8uhksazuncvxpgynyun39gsxapt2pnpp5mc207x87p0nqmzwnxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9e5j7s</id>
    
      <title type="html">Learn: Array What: items stored side by side in memory, each at ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsq8uhksazuncvxpgynyun39gsxapt2pnpp5mc207x87p0nqmzwnxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9e5j7s" />
    <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-15T17:38:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswhmwq4wmzw8rka2dle64nxyh47hnmlhtnspkv7pzq9yp8zhx76mszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxcemm4</id>
    
      <title type="html">Learn: Value types vs reference types A value type (struct, int, ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswhmwq4wmzw8rka2dle64nxyh47hnmlhtnspkv7pzq9yp8zhx76mszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxcemm4" />
    <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-15T17:07:57Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs29rpj7u9ce5q597k3dc7t64g7xyfjg8m3hq497e6yc40jvur692czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwjepgl</id>
    
      <title type="html">Learn: Linked list What: nodes, each holding a value and a link ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs29rpj7u9ce5q597k3dc7t64g7xyfjg8m3hq497e6yc40jvur692czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwjepgl" />
    <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-15T16:38:10Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszvmefy0dq884p5na57zegus6g2zc5lld0fvy63rc0dskzxmr4ltgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juff60y</id>
    
      <title type="html">Learn: What a load balancer does It spreads incoming requests ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszvmefy0dq884p5na57zegus6g2zc5lld0fvy63rc0dskzxmr4ltgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38juff60y" />
    <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-15T16:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsw5t7whzzrdwr6c0qaxmy439c0lw5etrh4p2xnhghgh58v7nsjdxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jedyzz9</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsw5t7whzzrdwr6c0qaxmy439c0lw5etrh4p2xnhghgh58v7nsjdxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jedyzz9" />
    <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-15T15:38:17Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswsx6g2seg7gza38u83f0rzm086va7k9lf2l69rvevhkrc6urdrdgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7hhn5c</id>
    
      <title type="html">Learn: Mutex A Mutex is a lock that can also work across ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswsx6g2seg7gza38u83f0rzm086va7k9lf2l69rvevhkrc6urdrdgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7hhn5c" />
    <content type="html">
      Learn: Mutex&lt;br/&gt;&lt;br/&gt;A Mutex is a lock that can also work across processes when you give it a name. Example: allow only one copy of your app to run.&lt;br/&gt;It has thread affinity (it belongs to one thread): only the thread that took it can release it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var m = new Mutex();&lt;br/&gt;m.WaitOne();&lt;br/&gt;var t = new Thread(() =&amp;gt;&lt;br/&gt;{&lt;br/&gt;    try { m.ReleaseMutex(); } catch (ApplicationException) { Console.WriteLine(&amp;#34;only the owner can release&amp;#34;); }&lt;br/&gt;});&lt;br/&gt;t.Start(); t.Join();&lt;br/&gt;m.ReleaseMutex();&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints only the owner can release. Don&amp;#39;t hold a Mutex across await: the code after it may run on another thread, which can&amp;#39;t release it. Without a name, use lock instead: it is much faster.&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-076
    </content>
    <updated>2026-10-15T15:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs9srj6ghxwqk9gv59etyxzh9psrvrjqc6mfnuu6lsqt88jylyelmgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrt9809</id>
    
      <title type="html">Learn: Concurrency in .NET: which tool when A one-page map of ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs9srj6ghxwqk9gv59etyxzh9psrvrjqc6mfnuu6lsqt88jylyelmgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrt9809" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crsvjqxgcryd3dxycz6vf42scnwvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rs0578r8&#39;&gt;naddr1qq…78r8&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;/naddr1qqt4gj2s95crsvjqxgcryd3dxycz6vf42scnwvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guxlf8q8&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…f8q8&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-15T14:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsxdt6mtpf9ad7qjr997l9q0fa8u5wdcg6y6n8g0fvutcr8697julszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqt865h</id>
    
      <title type="html">Question: An algorithm does O(log n) steps. n grows from 1,000 to ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsxdt6mtpf9ad7qjr997l9q0fa8u5wdcg6y6n8g0fvutcr8697julszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqt865h" />
    <content type="html">
      Question: An algorithm does O(log n) steps. n grows from 1,000 to 1,000,000, a thousand times bigger.&lt;br/&gt;&lt;br/&gt;About how many more steps does it need?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big006 · BIG-006-Q1
    </content>
    <updated>2026-10-15T14:08:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsypsxv8w28muj79d4p9wr325ll2qcyf9js6kx6vgpdf4r882cmscszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je0jwj0</id>
    
      <title type="html">Only about 10 more. log₂ of 1,000 is about 10, and log₂ of ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsypsxv8w28muj79d4p9wr325ll2qcyf9js6kx6vgpdf4r882cmscszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38je0jwj0" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsxdt6mtpf9ad7qjr997l9q0fa8u5wdcg6y6n8g0fvutcr8697julspz3mhxue69uhhyetvv9ujuerpd46hxtnfdua2ru55&#39;&gt;nevent1q…ru55&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Only about 10 more.&lt;br/&gt;&lt;br/&gt;log₂ of 1,000 is about 10, and log₂ of 1,000,000 is about 20. The input grew 1,000 times, but the steps only doubled. That is why O(log n) algorithms are so fast on big inputs.&lt;br/&gt;&lt;br/&gt;#big006 · BIG-006-A1
    </content>
    <updated>2026-10-15T14:08:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs876dgdedq5ttzcs97r2n77a5v5kjy0zxgrnyqzstv2433nwtjy6szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jfwtazl</id>
    
      <title type="html">Learn: Grid problems: flood fill How to walk a grid in four ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs876dgdedq5ttzcs97r2n77a5v5kjy0zxgrnyqzstv2433nwtjy6szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jfwtazl" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvw2qxgcryd3dxycz6vf42scnvvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsmt2gep&#39;&gt;naddr1qq…2gep&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Grid problems: flood fill&lt;br/&gt;&lt;br/&gt;How to walk a grid in four directions, stay inside the bounds, and count connected areas.&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;/naddr1qqt4gj2s95crvw2qxgcryd3dxycz6vf42scnvvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu8wa7s9&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…a7s9&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;grid-problems-flood-fill-2&#34;&gt;Grid problems: flood fill&lt;/h2&gt;

&lt;p&gt;Many interview questions give you a grid of cells: a map, an image, a maze. The key move is &lt;strong&gt;flood fill&lt;/strong&gt;: from one cell, visit every connected cell of the same kind.&lt;/p&gt;

&lt;h3 id=&#34;counting-areas-2&#34;&gt;Counting areas&lt;/h3&gt;

&lt;p&gt;Count the separate areas of &lt;code&gt;1&lt;/code&gt;s (cells connected up, down, left or right):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;string[] map = { &amp;#34;11000&amp;#34;, &amp;#34;11001&amp;#34;, &amp;#34;00001&amp;#34; };
int rows = map.Length, cols = map[0].Length, areas = 0; var seen = new bool[rows, cols];
for (int r = 0; r &amp;lt; rows; r&#43;&#43;) for (int c = 0; c &amp;lt; cols; c&#43;&#43;)
    if (map[r][c] == &amp;#39;1&amp;#39; &amp;amp;&amp;amp; !seen[r, c]) { areas&#43;&#43;; Fill(r, c); }
Console.WriteLine(areas);
void Fill(int r, int c)
{
    if (r &amp;lt; 0 || c &amp;lt; 0 || r &amp;gt;= rows || c &amp;gt;= cols || seen[r, c] || map[r][c] == &amp;#39;0&amp;#39;) return;
    seen[r, c] = true; Fill(r &#43; 1, c); Fill(r - 1, c); Fill(r, c &#43; 1); Fill(r, c - 1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;2&lt;/code&gt;: one area of four cells top-left, and one of two cells on the right.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Loop over every cell.&lt;/li&gt;
&lt;li&gt;When you find an unvisited &lt;code&gt;1&lt;/code&gt;, count a new area and flood-fill it.&lt;/li&gt;
&lt;li&gt;The fill marks cells as seen and spreads in four directions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Check the bounds first&lt;/strong&gt; (row and column inside the grid) before reading a cell; this is where most bugs are.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Each cell is visited a constant number of times: &lt;strong&gt;O(rows × cols)&lt;/strong&gt; time. The &lt;code&gt;seen&lt;/code&gt; grid is O(rows × cols) memory. The recursion can go as deep as the area is big; for very large grids, use a queue (breadth-first) instead of recursion.&lt;/p&gt;

&lt;h3 id=&#34;c-note-2&#34;&gt;C# note&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;int[,]&lt;/code&gt; is one rectangular block; &lt;code&gt;int[][]&lt;/code&gt; (jagged) is an array of arrays, where rows can differ in length. Many online judges give you jagged arrays.&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&gt;#tip · TIP-069&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-069
    </content>
    <updated>2026-10-15T13:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswdv2fxfppnzpx6q40qnj954u9k0r53vpk3z7zzsta6hdejdd4fuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj44uku</id>
    
      <title type="html">Learn: Interface An interface is a contract: members a class must ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswdv2fxfppnzpx6q40qnj954u9k0r53vpk3z7zzsta6hdejdd4fuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jj44uku" />
    <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-15T13:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsy62twkg6ys728kx9pegw0lfxxpl6st4f6n9f9fh2hwe5p2cuu0xczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j84yrfm</id>
    
      <title type="html">Learn: Data structures: which one when? A one-page cheat sheet: ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsy62twkg6ys728kx9pegw0lfxxpl6st4f6n9f9fh2hwe5p2cuu0xczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j84yrfm" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vf42scn2vesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsh86x7r&#39;&gt;naddr1qq…6x7r&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;/naddr1qqt4gj2s95crxvjqxgcryd3dxycz6vf42scn2vesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guaqhk6c&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…hk6c&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;data-structures-which-one-when-5&#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-5&#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-5&#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-15T12:38:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsde6eaqa59ty4cy9syyaarzhg5gnwa2kg346h28rgwz3pejrkgdmczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jkqd2rl</id>
    
      <title type="html">Learn: Queue What: first in, first out, like a line at a shop. ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsde6eaqa59ty4cy9syyaarzhg5gnwa2kg346h28rgwz3pejrkgdmczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jkqd2rl" />
    <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-15T12:02:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszyjgsmxe3wf7lwghp9k9l72a4nua6qj5f8za3ajz4qlvf989wmegzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jty2pw2</id>
    
      <title type="html">Learn: Bitwise tricks Operators: &amp;amp; (and), | (or), ^ (xor), ~ ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszyjgsmxe3wf7lwghp9k9l72a4nua6qj5f8za3ajz4qlvf989wmegzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jty2pw2" />
    <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-15T11:37:58Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsz5ha5dlp2fc5fdn3j6287g3snnt4ea6gynzzud5m67598alw4w0czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jy0s74d</id>
    
      <title type="html">Learn: Authentication vs authorization Authentication: who are ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsz5ha5dlp2fc5fdn3j6287g3snnt4ea6gynzzud5m67598alw4w0czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jy0s74d" />
    <content type="html">
      Learn: Authentication vs authorization&lt;br/&gt;&lt;br/&gt;Authentication: who are you? (login, a cookie, a token)&lt;br/&gt;Authorization: what may you do? (roles, policies)&lt;br/&gt;On a protected endpoint: no valid login → 401; logged in but not allowed → 403. (Cookie login redirects web pages to a login page; since .NET 10, API endpoints get 401/403.)&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, &amp;#34;ann&amp;#34;), new Claim(ClaimTypes.Role, &amp;#34;Admin&amp;#34;) }, &amp;#34;demo&amp;#34;);&lt;br/&gt;var user = new ClaimsPrincipal(identity);&lt;br/&gt;Console.WriteLine($&amp;#34;{user.Identity!.IsAuthenticated} {user.IsInRole(&amp;#34;Admin&amp;#34;)} {user.IsInRole(&amp;#34;Billing&amp;#34;)}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True True False. IsAuthenticated is true only because an authentication type (&amp;#34;demo&amp;#34;) was given. ASP.NET Core builds this ClaimsPrincipal for every request (HttpContext.User).&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/aspnet/core/security/authentication/&#34;&gt;https://learn.microsoft.com/en-us/aspnet/core/security/authentication/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-083
    </content>
    <updated>2026-10-15T11:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs90nm8p68nt8me43gvha6w9k7v6ffm95rf5fw98jagm338sw6qvrqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp9rqc2</id>
    
      <title type="html">Learn: Merge sort, step by step How merge sort splits, sorts and ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs90nm8p68nt8me43gvha6w9k7v6ffm95rf5fw98jagm338sw6qvrqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jp9rqc2" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vf42scnxvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rskcm8g2&#39;&gt;naddr1qq…m8g2&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;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vf42scnxvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gugxc9t3&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…c9t3&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-15T10:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs0pr7fvzcr28tgmgl57afjestdr67xc725nwx8n3s8d4g4x23fa3czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jgdnc6e</id>
    
      <title type="html">Go forward with a loop and keep only the last two values: ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs0pr7fvzcr28tgmgl57afjestdr67xc725nwx8n3s8d4g4x23fa3czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jgdnc6e" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsp7kjj7y7cg00uvgnnx2kcl4xe4rqtzejvaena7jf6me5k73372wspz3mhxue69uhhyetvv9ujuerpd46hxtnfdukz9dyt&#39;&gt;nevent1q…9dyt&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Go forward with a loop and keep only the last two values:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;long a = 0, b = 1;&lt;br/&gt;for (int i = 0; i &amp;lt; 50; i&#43;&#43;) (a, b) = (b, a &#43; b);&lt;br/&gt;Console.WriteLine(a);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 12586269025. O(n) time, O(1) memory, and no recursion, so no risk of a stack overflow.&lt;br/&gt;&lt;br/&gt;#big011 · BIG-011-A3
    </content>
    <updated>2026-10-15T10:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsp7kjj7y7cg00uvgnnx2kcl4xe4rqtzejvaena7jf6me5k73372wszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhdwqat</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;Now compute Fib(n) with O(1) ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsp7kjj7y7cg00uvgnnx2kcl4xe4rqtzejvaena7jf6me5k73372wszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhdwqat" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;Now compute Fib(n) with O(1) memory.&amp;#34;&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big011 · BIG-011-Q3
    </content>
    <updated>2026-10-15T10:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsr5vyraulzmn9rd3dgkj0vnxnz9yn32w30hz73sr3v4av02atknxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqzktas</id>
    
      <title type="html">Learn: Value types vs reference types A value type (struct, int, ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsr5vyraulzmn9rd3dgkj0vnxnz9yn32w30hz73sr3v4av02atknxqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jqzktas" />
    <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-15T09:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgsf0qw5njwq0vrtgcqq5szspf8sf0sjhaz7v8nx0qcr4p49wmy7gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j97nzjk</id>
    
      <title type="html">Learn: Decorator Wrap an object in another object of the same ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgsf0qw5njwq0vrtgcqq5szspf8sf0sjhaz7v8nx0qcr4p49wmy7gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j97nzjk" />
    <content type="html">
      Learn: Decorator&lt;br/&gt;&lt;br/&gt;Wrap an object in another object of the same type that adds behavior before or after it.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;INotifier n = new Loud(new Plain());&lt;br/&gt;Console.WriteLine(n.Send(&amp;#34;hi&amp;#34;));&lt;br/&gt;&lt;br/&gt;interface INotifier { string Send(string m); }&lt;br/&gt;class Plain : INotifier { public string Send(string m) =&amp;gt; m; }&lt;br/&gt;class Loud(INotifier inner) : INotifier { public string Send(string m) =&amp;gt; inner.Send(m).ToUpper() &#43; &amp;#34;!&amp;#34;; }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints HI!.&lt;br/&gt;You already use it: GZipStream wraps another Stream and adds compression. (ASP.NET Core middleware is a similar wrapping idea, usually called a pipeline.) Use it to add logging, caching or retries without changing the original class.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/decorator-pattern/&#34;&gt;https://www.geeksforgeeks.org/system-design/decorator-pattern/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-055
    </content>
    <updated>2026-10-15T09:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqq35lp285vgvgptm6662af0uj3tf5jwyeswa5twht055mlg6ghwqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jc9lws9</id>
    
      <title type="html">Learn: Scoped services in a singleton or BackgroundService A ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsqq35lp285vgvgptm6662af0uj3tf5jwyeswa5twht055mlg6ghwqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jc9lws9" />
    <content type="html">
      Learn: Scoped services in a singleton or BackgroundService&lt;br/&gt;&lt;br/&gt;A BackgroundService is a singleton, but a DbContext is scoped. Injecting the DbContext directly would keep one DbContext forever.&lt;br/&gt;Fix: inject IServiceScopeFactory. For each piece of work: create a scope, get the DbContext from it, and dispose the scope when done.&lt;br/&gt;In Development, ASP.NET Core checks this for you (scope validation) and throws at startup if a singleton depends on a scoped service.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection&#34;&gt;https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-096
    </content>
    <updated>2026-10-15T08:38:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgzfefzdledrwfdzt6p9ue3rgf3l67yzszw50wz5llxqd3x52r29qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9gvux6</id>
    
      <title type="html">Question: The fast/slow cycle loop runs while (fast?.Next != ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgzfefzdledrwfdzt6p9ue3rgf3l67yzszw50wz5llxqd3x52r29qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j9gvux6" />
    <content type="html">
      Question: The fast/slow cycle loop runs while (fast?.Next != null). These two lists have no cycle:&lt;br/&gt;&lt;br/&gt;1 → 2 → 3&lt;br/&gt;1 → 2 → 3 → 4&lt;br/&gt;&lt;br/&gt;For each one, where is fast when the loop stops? And why must the condition check both fast and fast.Next?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#ll014 · LL-014-Q2
    </content>
    <updated>2026-10-15T08:08:06Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs8tzzm2jtzt67vxz4ddnrdz8v8qjhs258hjwn3ymaxlfv664dz6cgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jfzcu3x</id>
    
      <title type="html">1 → 2 → 3: fast jumps from 1 to 3. Node 3 is the last node, ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs8tzzm2jtzt67vxz4ddnrdz8v8qjhs258hjwn3ymaxlfv664dz6cgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jfzcu3x" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsgzfefzdledrwfdzt6p9ue3rgf3l67yzszw50wz5llxqd3x52r29qpz3mhxue69uhhyetvv9ujuerpd46hxtnfduj2k0we&#39;&gt;nevent1q…k0we&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;1 → 2 → 3: fast jumps from 1 to 3. Node 3 is the last node, so fast.Next is null and the loop stops with fast on node 3.&lt;br/&gt;1 → 2 → 3 → 4: fast jumps from 1 to 3, then to 3.Next.Next, which is null. The loop stops with fast null.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;foreach (Node head in new[] { Build(1, 2, 3), Build(1, 2, 3, 4) })&lt;br/&gt;{&lt;br/&gt;    Node? slow = head, fast = head;&lt;br/&gt;    while (fast?.Next != null) { slow = slow!.Next; fast = fast.Next.Next; if (slow == fast) break; }&lt;br/&gt;    Console.WriteLine(fast == null ? &amp;#34;fast is null&amp;#34; : $&amp;#34;fast is on node {fast.Value}&amp;#34;);&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;So the end of the list shows up in two ways. Check only fast != null, and an odd-length list reads fast.Next.Next on the last node, where fast.Next is null: a NullReferenceException. Check only fast.Next, and an even-length list throws on the null fast. fast?.Next != null covers both.&lt;br/&gt;&lt;br/&gt;#ll014 · LL-014-A2
    </content>
    <updated>2026-10-15T08:08:06Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqv99tsufywdkf0tfgzu7l5hemvgncy8d3wr0nxstp7jqyhwmuz2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxy9zhd</id>
    
      <title type="html">Learn: Monolith vs microservices What each architecture is, the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsqv99tsufywdkf0tfgzu7l5hemvgncy8d3wr0nxstp7jqyhwmuz2gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jxy9zhd" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvv2qxgcryd3dxycz6vf42scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsh2tgs9&#39;&gt;naddr1qq…tgs9&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Monolith vs microservices&lt;br/&gt;&lt;br/&gt;What each architecture is, the real trade-offs, and how to answer the classic interview question.&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;/naddr1qqt4gj2s95crvv2qxgcryd3dxycz6vf42scnqvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu7ztmlm&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…tmlm&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;monolith-vs-microservices-2&#34;&gt;Monolith vs microservices&lt;/h2&gt;

&lt;h3 id=&#34;monolith-2&#34;&gt;Monolith&lt;/h3&gt;

&lt;p&gt;One codebase, one deployable. All features run in the same process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pros:&lt;/strong&gt; simple to develop, test, debug and deploy. Calls between parts are fast in-process calls. One database keeps data consistent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cons:&lt;/strong&gt; you scale everything together. A large codebase gets slow to change and to build. One bad deploy or crash affects every feature.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;microservices-2&#34;&gt;Microservices&lt;/h3&gt;

&lt;p&gt;Many small services, each with one job, &lt;strong&gt;its own data&lt;/strong&gt;, and its own deployment. They talk over HTTP or messages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pros:&lt;/strong&gt; teams deploy independently. You scale only the busy service. A failure can stay inside one service.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cons:&lt;/strong&gt; network calls are slower and can fail, so you need timeouts and retries. Data is spread out, so there is no simple transaction across services. You need logging, tracing, monitoring and automated deployment from day one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;how-to-choose-2&#34;&gt;How to choose&lt;/h3&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Better fit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;New product, small team, changing requirements&lt;/td&gt;
&lt;td&gt;Monolith&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Several teams stepping on each other in one codebase&lt;/td&gt;
&lt;td&gt;Microservices&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;One part needs much more scale than the rest&lt;/td&gt;
&lt;td&gt;Split out that part&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A popular middle way is the &lt;strong&gt;modular monolith&lt;/strong&gt;: one deployable, but clear internal modules with their own boundaries. Modules can later become services when there is a real reason.&lt;/p&gt;

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

&lt;p&gt;Don&amp;#39;t say one is always better. Say: &lt;em&gt;start with a monolith with clear modules; move a module to its own service when a team or scaling need justifies the extra complexity.&lt;/em&gt; Then mention what microservices require: independent data, network resilience, and observability.&lt;/p&gt;

&lt;p&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;/p&gt;

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

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsv9950rwwl5ycwq0d5xaldelg2tsqcuy0ng35hsz63cug6c38z4sgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0xmyza</id>
    
      <title type="html">Learn: Deadlock Thread 1 holds lock A and waits for B. Thread 2 ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsv9950rwwl5ycwq0d5xaldelg2tsqcuy0ng35hsz63cug6c38z4sgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j0xmyza" />
    <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-15T07:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsxjmvrg7mzq56allwlgxh32g084j8e6rlvrd3xdghxvelrjgeuq5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jz86kyg</id>
    
      <title type="html">Learn: IDisposable and using Some objects hold things the garbage ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsxjmvrg7mzq56allwlgxh32g084j8e6rlvrd3xdghxvelrjgeuq5gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jz86kyg" />
    <content type="html">
      Learn: IDisposable and using&lt;br/&gt;&lt;br/&gt;Some objects hold things the garbage collector doesn&amp;#39;t manage well: files, network connections, database connections. They implement IDisposable, and you must call Dispose when done.&lt;br/&gt;using does it for you, even if an exception is thrown:&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;using (var r = new Resource()) Console.WriteLine(&amp;#34;working&amp;#34;);&lt;br/&gt;Console.WriteLine(&amp;#34;after&amp;#34;);&lt;br/&gt;&lt;br/&gt;class Resource : IDisposable { public void Dispose() =&amp;gt; Console.WriteLine(&amp;#34;cleaned up&amp;#34;); }&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints working, cleaned up, after.&lt;br/&gt;Shorter form: using var file = File.OpenRead(path); disposes at the end of the method or block.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&#34;&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-101
    </content>
    <updated>2026-10-15T06:37:59Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqstr6t8xsk9gvd09unr52wl0u9t0tqh9ze5sdfctgjkcu79k32lpxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtemnea</id>
    
      <title type="html">Merge them one by one: simple, but the result list is walked ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqstr6t8xsk9gvd09unr52wl0u9t0tqh9ze5sdfctgjkcu79k32lpxszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtemnea" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqs2hsrxjl5ex7caq7w4xtrv8c3s9vpx22jm49x0dmxfq8kz8ljnd7qpz3mhxue69uhhyetvv9ujuerpd46hxtnfdujm4r6w&#39;&gt;nevent1q…4r6w&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Merge them one by one: simple, but the result list is walked again and again, O(N · k) for N nodes in total.&lt;br/&gt;&lt;br/&gt;Better: put the k front nodes in a min-heap (in .NET, PriorityQueue). Take the smallest, then add that list&amp;#39;s next node. Each node costs one heap step, O(log k), so O(N log k) in total.&lt;br/&gt;&lt;br/&gt;#ll013 · LL-013-A3
    </content>
    <updated>2026-10-15T06:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs2hsrxjl5ex7caq7w4xtrv8c3s9vpx22jm49x0dmxfq8kz8ljnd7qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju07a0m</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;Now merge k sorted lists.&amp;#34; ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs2hsrxjl5ex7caq7w4xtrv8c3s9vpx22jm49x0dmxfq8kz8ljnd7qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju07a0m" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;Now merge k sorted lists.&amp;#34; What are your options?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#ll013 · LL-013-Q3
    </content>
    <updated>2026-10-15T06:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs92zekay7xdm0y7k9rtzwct848nn96yqkdl0clgp29ycfgsmk465szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jw6q02c</id>
    
      <title type="html">Learn: Tree traversals The four ways to visit a tree, when each ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs92zekay7xdm0y7k9rtzwct848nn96yqkdl0clgp29ycfgsmk465szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jw6q02c" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvdzqxgcryd3dxycz6vf42scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rs6g5drh&#39;&gt;naddr1qq…5drh&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;/naddr1qqt4gj2s95crvdzqxgcryd3dxycz6vf42scrsvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gu8lz89k&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…z89k&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-8&#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-15T05:38:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsfvscwt5gms9x02jd6z6er0t4c4ljsa4wsdrfv0zda7xa23qceswczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jpgkv0x</id>
    
      <title type="html">Learn: Linked list classic: reverse it Interviewers want your own ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsfvscwt5gms9x02jd6z6er0t4c4ljsa4wsdrfv0zda7xa23qceswczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jpgkv0x" />
    <content type="html">
      Learn: Linked list classic: reverse it&lt;br/&gt;&lt;br/&gt;Interviewers want your own Node class, not LinkedList&amp;lt;T&amp;gt;. Walk the list and point each node back to the one before it. Save the next node first, or you lose the rest of the list.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Node? cur = new Node(1, new Node(2, new Node(3, null))), prev = null;&lt;br/&gt;while (cur != null)&lt;br/&gt;{&lt;br/&gt;    Node? next = cur.Next; // save it before relinking&lt;br/&gt;    cur.Next = prev;&lt;br/&gt;    prev = cur;&lt;br/&gt;    cur = next;&lt;br/&gt;}&lt;br/&gt;Console.WriteLine($&amp;#34;{prev!.Value} {prev.Next!.Value} {prev.Next.Next!.Value}&amp;#34;);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 3 2 1. O(n) time, O(1) memory.&lt;br/&gt;The other classic: fast and slow pointers (fast moves 2, slow moves 1) find the middle, or detect a cycle when they meet.&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-063
    </content>
    <updated>2026-10-15T05:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs9lh9ey5ysf5jp5kug5xfc5a3yu0uj84x2ja7aqsrcsgl7wlzertgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhlwcej</id>
    
      <title type="html">Learn: Two pointers Two indexes walk the data instead of nested ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs9lh9ey5ysf5jp5kug5xfc5a3yu0uj84x2ja7aqsrcsgl7wlzertgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jhlwcej" />
    <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-14T18:38:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszqvthyxhfalrh32jany6guyrhzvp7kp4jr6mhqyyzve05dpj29gczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtah2pm</id>
    
      <title type="html">Learn: Big-O rules in one post 1. Drop constants: O(2n) is O(n). ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszqvthyxhfalrh32jany6guyrhzvp7kp4jr6mhqyyzve05dpj29gczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jtah2pm" />
    <content type="html">
      Learn: Big-O rules in one post&lt;br/&gt;&lt;br/&gt;1. Drop constants: O(2n) is O(n).&lt;br/&gt;2. Keep only the biggest term: O(n² &#43; n) is O(n²).&lt;br/&gt;3. Loops one after another add: O(n) then O(n) is still O(n).&lt;br/&gt;4. Nested loops multiply: a loop over n inside a loop over n is O(n²).&lt;br/&gt;5. Different inputs get different letters: n for one, m for the other.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;int n = 3, m = 4, steps = 0;&lt;br/&gt;for (int i = 0; i &amp;lt; n; i&#43;&#43;)&lt;br/&gt;    for (int j = 0; j &amp;lt; m; j&#43;&#43;) steps&#43;&#43;;&lt;br/&gt;Console.WriteLine(steps);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 12: n · m steps.&lt;br/&gt;&lt;br/&gt;#big005 · BIG-005-N
    </content>
    <updated>2026-10-14T18:08:07Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsx4kzzwqfew6yqkx3lv9dmjmml65675ev9jncx4zsxxqf0jflcd7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jt0lg5g</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsx4kzzwqfew6yqkx3lv9dmjmml65675ev9jncx4zsxxqf0jflcd7czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jt0lg5g" />
    <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-14T17:38:36Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsx7pdcyajd9stln08rzwrvrw7q68z0lv66wf0gtgd5732l54nx3hczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jelcxrx</id>
    
      <title type="html">Learn: PriorityQueue for &amp;#34;smallest first&amp;#34; .NET has ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsx7pdcyajd9stln08rzwrvrw7q68z0lv66wf0gtgd5732l54nx3hczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jelcxrx" />
    <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-14T17:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqpgge2v9vl0ajlj3qx5lev5spc9ruuja4n5h9hdn7yp4ntg7ejjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jewc6xt</id>
    
      <title type="html">Learn: Queues decouple services Put a message queue between a ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsqpgge2v9vl0ajlj3qx5lev5spc9ruuja4n5h9hdn7yp4ntg7ejjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jewc6xt" />
    <content type="html">
      Learn: Queues decouple services&lt;br/&gt;&lt;br/&gt;Put a message queue between a service that produces work and one that does it. The producer doesn&amp;#39;t wait, and a slow consumer just builds a backlog instead of failing.&lt;br/&gt;&lt;br/&gt;Most queues deliver &amp;#34;at least once&amp;#34;, so a message can arrive twice. Make consumers idempotent (same result when repeated): processing the same message twice must be safe.&lt;br/&gt;&lt;br/&gt;#tip · TIP-018
    </content>
    <updated>2026-10-14T16:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsxjxn5n9udjtkdtymasnq8sptz0uzentq643kr3lurupmnnvp3wcqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jt9yrv0</id>
    
      <title type="html">Learn: Observer When something happens, notify everyone who ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsxjxn5n9udjtkdtymasnq8sptz0uzentq643kr3lurupmnnvp3wcqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jt9yrv0" />
    <content type="html">
      Learn: Observer&lt;br/&gt;&lt;br/&gt;When something happens, notify everyone who subscribed. The sender doesn&amp;#39;t know who listens.&lt;br/&gt;C# has it built in: events.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var button = new Button();&lt;br/&gt;button.Clicked &#43;= () =&amp;gt; Console.WriteLine(&amp;#34;saved&amp;#34;);&lt;br/&gt;button.Clicked &#43;= () =&amp;gt; Console.WriteLine(&amp;#34;logged&amp;#34;);&lt;br/&gt;button.Click();&lt;br/&gt;&lt;br/&gt;class Button&lt;br/&gt;{&lt;br/&gt;    public event Action? Clicked;&lt;br/&gt;    public void Click() =&amp;gt; Clicked?.Invoke();&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints saved, then logged.&lt;br/&gt;Use it for UI events, domain events (&amp;#34;order placed&amp;#34;), and notifications.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/system-design/observer-pattern-set-1-introduction/&#34;&gt;https://www.geeksforgeeks.org/system-design/observer-pattern-set-1-introduction/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-054
    </content>
    <updated>2026-10-14T15:38:15Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsvsyczpxkr4c39p5yswk3zhanx9lscq0d0upet4mp8sknf6v98zcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjh09g8</id>
    
      <title type="html">Learn: Grid problems: flood fill How to walk a grid in four ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsvsyczpxkr4c39p5yswk3zhanx9lscq0d0upet4mp8sknf6v98zcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjh09g8" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crvw2qxgcryd3dxycz6vf52scnsvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsnade4k&#39;&gt;naddr1qq…de4k&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Grid problems: flood fill&lt;br/&gt;&lt;br/&gt;How to walk a grid in four directions, stay inside the bounds, and count connected areas.&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;/naddr1qqt4gj2s95crvw2qxgcryd3dxycz6vf52scnsvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gug3xlcm&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…xlcm&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;grid-problems-flood-fill-5&#34;&gt;Grid problems: flood fill&lt;/h2&gt;

&lt;p&gt;Many interview questions give you a grid of cells: a map, an image, a maze. The key move is &lt;strong&gt;flood fill&lt;/strong&gt;: from one cell, visit every connected cell of the same kind.&lt;/p&gt;

&lt;h3 id=&#34;counting-areas-5&#34;&gt;Counting areas&lt;/h3&gt;

&lt;p&gt;Count the separate areas of &lt;code&gt;1&lt;/code&gt;s (cells connected up, down, left or right):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;string[] map = { &amp;#34;11000&amp;#34;, &amp;#34;11001&amp;#34;, &amp;#34;00001&amp;#34; };
int rows = map.Length, cols = map[0].Length, areas = 0; var seen = new bool[rows, cols];
for (int r = 0; r &amp;lt; rows; r&#43;&#43;) for (int c = 0; c &amp;lt; cols; c&#43;&#43;)
    if (map[r][c] == &amp;#39;1&amp;#39; &amp;amp;&amp;amp; !seen[r, c]) { areas&#43;&#43;; Fill(r, c); }
Console.WriteLine(areas);
void Fill(int r, int c)
{
    if (r &amp;lt; 0 || c &amp;lt; 0 || r &amp;gt;= rows || c &amp;gt;= cols || seen[r, c] || map[r][c] == &amp;#39;0&amp;#39;) return;
    seen[r, c] = true; Fill(r &#43; 1, c); Fill(r - 1, c); Fill(r, c &#43; 1); Fill(r, c - 1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;2&lt;/code&gt;: one area of four cells top-left, and one of two cells on the right.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Loop over every cell.&lt;/li&gt;
&lt;li&gt;When you find an unvisited &lt;code&gt;1&lt;/code&gt;, count a new area and flood-fill it.&lt;/li&gt;
&lt;li&gt;The fill marks cells as seen and spreads in four directions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Check the bounds first&lt;/strong&gt; (row and column inside the grid) before reading a cell; this is where most bugs are.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Each cell is visited a constant number of times: &lt;strong&gt;O(rows × cols)&lt;/strong&gt; time. The &lt;code&gt;seen&lt;/code&gt; grid is O(rows × cols) memory. The recursion can go as deep as the area is big; for very large grids, use a queue (breadth-first) instead of recursion.&lt;/p&gt;

&lt;h3 id=&#34;c-note-5&#34;&gt;C# note&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;int[,]&lt;/code&gt; is one rectangular block; &lt;code&gt;int[][]&lt;/code&gt; (jagged) is an array of arrays, where rows can differ in length. Many online judges give you jagged arrays.&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&gt;#tip · TIP-069&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-069
    </content>
    <updated>2026-10-14T15:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsquaat0zwnlsd5c5qw62txfdtjwzt0e2u6r725t2gtsgcp59aq03gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j59eyq0</id>
    
      <title type="html">Learn: Abstract class An abstract class is a base class you ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsquaat0zwnlsd5c5qw62txfdtjwzt0e2u6r725t2gtsgcp59aq03gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j59eyq0" />
    <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-14T14:38:21Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsv4dh6wsznk8zuwlselvsdws49s9pd8lhk7nrkdxm02hrc30mecnqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjaq7ve</id>
    
      <title type="html">Question: One loop prints every item of array a (length n). After ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsv4dh6wsznk8zuwlselvsdws49s9pd8lhk7nrkdxm02hrc30mecnqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjaq7ve" />
    <content type="html">
      Question: One loop prints every item of array a (length n). After it, a second loop prints every item of array b (length m).&lt;br/&gt;&lt;br/&gt;What is the Big-O? And what if the second loop is inside the first?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big005 · BIG-005-Q1
    </content>
    <updated>2026-10-14T14:08:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsp2nczhvsl3z4yzawmlgdlssdajp6v9wnqaaxayjlcq288punng5qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjv2tdv</id>
    
      <title type="html">One after the other: O(n &#43; m). The loops add. Nested: O(n · m). ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsp2nczhvsl3z4yzawmlgdlssdajp6v9wnqaaxayjlcq288punng5qzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjv2tdv" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsv4dh6wsznk8zuwlselvsdws49s9pd8lhk7nrkdxm02hrc30mecnqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduu9hjvr&#39;&gt;nevent1q…hjvr&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;One after the other: O(n &#43; m). The loops add.&lt;br/&gt;&lt;br/&gt;Nested: O(n · m). For every item of a, the inner loop walks all of b.&lt;br/&gt;&lt;br/&gt;Don&amp;#39;t write O(n) or O(n²) here: a and b have different sizes, so each gets its own letter.&lt;br/&gt;&lt;br/&gt;#big005 · BIG-005-A1
    </content>
    <updated>2026-10-14T14:08:23Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqst0k9d47vj8th3tls6cl2x9hrta9dqk3mx2vcyd56q56t8uwg85lgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyk3g80</id>
    
      <title type="html">Learn: Service lifetimes Transient: a new object every time the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqst0k9d47vj8th3tls6cl2x9hrta9dqk3mx2vcyd56q56t8uwg85lgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyk3g80" />
    <content type="html">
      Learn: Service lifetimes&lt;br/&gt;&lt;br/&gt;Transient: a new object every time the service is asked for (resolved). For light, stateless helpers.&lt;br/&gt;Scoped: one object per web request. For things like a database context.&lt;br/&gt;Singleton: one object for the whole app, until it shuts down. For caches and configuration.&lt;br/&gt;&lt;br/&gt;Classic bug: a singleton (or a BackgroundService) that keeps a scoped service, which then lives forever. Fix: create a scope with IServiceScopeFactory for each piece of work.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/service-lifetimes&#34;&gt;https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/service-lifetimes&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-044
    </content>
    <updated>2026-10-14T13:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs96m9r204adrpt65sjt2evwa9sn2syes797fd485u2hw3tg6gutpgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwtdte6</id>
    
      <title type="html">Learn: Linear search What: check the items one by one until you ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs96m9r204adrpt65sjt2evwa9sn2syes797fd485u2hw3tg6gutpgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jwtdte6" />
    <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-14T13:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs07nse72w5zllwsy2ln3dxjts2t8jvcerd5h9a5u3p0rpe4vfypmqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5r53uk</id>
    
      <title type="html">Learn: Merge sort, step by step How merge sort splits, sorts and ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs07nse72w5zllwsy2ln3dxjts2t8jvcerd5h9a5u3p0rpe4vfypmqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j5r53uk" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vf52scn2vesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rseked8x&#39;&gt;naddr1qq…ed8x&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;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vf52scn2vesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guwactjv&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…ctjv&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;merge-sort-step-by-step-5&#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-5&#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-5&#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-14&#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-5&#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-14T12:38:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsxa0w3f8ra6qq5tq697rmct8eq4umc9p6kh4z82jqdhxr3jvzmn9czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjsndy8</id>
    
      <title type="html">Learn: Matrix What: a grid of rows and columns; m[row, col] reads ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsxa0w3f8ra6qq5tq697rmct8eq4umc9p6kh4z82jqdhxr3jvzmn9czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjsndy8" />
    <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-14T12:08:14Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgdq0ywj8qpqx6l72858t2ua87q5jvd42nh82djxx4a6k2qezr4uczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jzqc3hx</id>
    
      <title type="html">Learn: Think out loud In a coding interview, the interviewer ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgdq0ywj8qpqx6l72858t2ua87q5jvd42nh82djxx4a6k2qezr4uczyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jzqc3hx" />
    <content type="html">
      Learn: Think out loud&lt;br/&gt;&lt;br/&gt;In a coding interview, the interviewer grades how you think, not only the final code. Say what you are trying, why, and what you would check next.&lt;br/&gt;&lt;br/&gt;Silence for five minutes looks the same as being stuck, even when you are close.&lt;br/&gt;&lt;br/&gt;#tip · TIP-001
    </content>
    <updated>2026-10-14T11:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsp9k2galttgkkuuemst205g0aqyegrr6dnc78fe2dcwcyx7vaxh0szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyj0m0c</id>
    
      <title type="html">Learn: Dependency injection in ASP.NET Core Why DI exists, how to ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsp9k2galttgkkuuemst205g0aqyegrr6dnc78fe2dcwcyx7vaxh0szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jyj0m0c" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crgd6qxgcryd3dxycz6vf52scngvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rsu3ll7y&#39;&gt;naddr1qq…ll7y&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Learn: Dependency injection in ASP.NET Core&lt;br/&gt;&lt;br/&gt;Why DI exists, how to register services, the three lifetimes, and the mistakes interviewers ask about.&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;/naddr1qqt4gj2s95crgd6qxgcryd3dxycz6vf52scngvpsqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4guttgsgw&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…gsgw&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;dependency-injection-in-asp-net-core-2&#34;&gt;Dependency injection in ASP.NET Core&lt;/h2&gt;

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

&lt;p&gt;A class shouldn&amp;#39;t create the things it depends on. It &lt;strong&gt;asks for them in its constructor&lt;/strong&gt;, and something outside provides them. That something is the DI container.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;IEmailSender sender = new ConsoleEmailSender();
var orders = new OrderService(sender);
orders.PlaceOrder(&amp;#34;book&amp;#34;);

interface IEmailSender { void Send(string text); }
class ConsoleEmailSender : IEmailSender { public void Send(string text) =&amp;gt; Console.WriteLine(text); }
class OrderService(IEmailSender sender)
{
    public void PlaceOrder(string item) =&amp;gt; sender.Send($&amp;#34;Ordered: {item}&amp;#34;);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It prints &lt;code&gt;Ordered: book&lt;/code&gt;. The demo wires the objects by hand; in ASP.NET Core the container does it. Swap &lt;code&gt;ConsoleEmailSender&lt;/code&gt; for a fake in a unit test, and &lt;code&gt;OrderService&lt;/code&gt; doesn&amp;#39;t change.&lt;/p&gt;

&lt;h3 id=&#34;registering-services-2&#34;&gt;Registering services&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;Program.cs&lt;/code&gt;, tell the container which class to use for each interface:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;builder.Services.AddTransient&amp;lt;IClock, SystemClock&amp;gt;();&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;builder.Services.AddScoped&amp;lt;IOrderRepository, SqlOrderRepository&amp;gt;();&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;builder.Services.AddSingleton&amp;lt;ICache, MemoryCache&amp;gt;();&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Controllers, minimal API handlers and other services then just list what they need in their constructors or parameters.&lt;/p&gt;

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

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Lifetime&lt;/th&gt;
&lt;th&gt;One object per…&lt;/th&gt;
&lt;th&gt;Typical use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Transient&lt;/td&gt;
&lt;td&gt;every time it is asked for (resolved)&lt;/td&gt;
&lt;td&gt;small stateless helpers&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Scoped&lt;/td&gt;
&lt;td&gt;HTTP request&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DbContext&lt;/code&gt;, unit of work&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;Singleton&lt;/td&gt;
&lt;td&gt;whole app&lt;/td&gt;
&lt;td&gt;caches, configuration, clients meant to be shared&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&#34;mistakes-interviewers-ask-about-2&#34;&gt;Mistakes interviewers ask about&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Captive dependency&lt;/strong&gt; (a longer-lived service holding a shorter-lived one): a singleton that takes a scoped service in its constructor keeps it for the whole app. A &lt;code&gt;DbContext&lt;/code&gt; shared by all requests is not thread-safe and breaks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;new&lt;/code&gt; inside the class:&lt;/strong&gt; creating dependencies with &lt;code&gt;new&lt;/code&gt; hides them and makes testing hard.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Too many constructor parameters:&lt;/strong&gt; a sign the class does too much.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;#tip · TIP-047&lt;/p&gt;
 &lt;/blockquote&gt;&lt;br/&gt;#tip · TIP-047
    </content>
    <updated>2026-10-14T11:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqstf4a2z0khjz43yqpyathmsxtlc946t0e3x6tcnhfqpj5zpa6ckqszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeju8uh</id>
    
      <title type="html">Learn: Ask before you code Before writing anything, ask about the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqstf4a2z0khjz43yqpyathmsxtlc946t0e3x6tcnhfqpj5zpa6ckqszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jeju8uh" />
    <content type="html">
      Learn: Ask before you code&lt;br/&gt;&lt;br/&gt;Before writing anything, ask about the input:&lt;br/&gt;&lt;br/&gt;Can it be empty or null?&lt;br/&gt;Are there duplicates or negative numbers?&lt;br/&gt;Is it sorted?&lt;br/&gt;How big can it get?&lt;br/&gt;&lt;br/&gt;The answers often change the best solution, and asking shows the interviewer you think about edge cases.&lt;br/&gt;&lt;br/&gt;#tip · TIP-002
    </content>
    <updated>2026-10-14T10:38:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsv2cxtrr3jv4hs90uqnj9vy3ejvg79q5e5eklupz8sv90he2q7pkgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvyssur</id>
    
      <title type="html">Both are O(n) time. The HashSet is simpler: the first node you ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsv2cxtrr3jv4hs90uqnj9vy3ejvg79q5e5eklupz8sv90he2q7pkgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvyssur" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqszqkqlfhuzqw7cfsrkax2qerqknjsshshel8dpx45vxawy0sealygpz3mhxue69uhhyetvv9ujuerpd46hxtnfdu394fzg&#39;&gt;nevent1q…4fzg&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Both are O(n) time.&lt;br/&gt;&lt;br/&gt;The HashSet is simpler: the first node you see twice is the loop start. But it stores nodes, so it needs O(n) memory.&lt;br/&gt;&lt;br/&gt;Fast and slow pointers need only O(1) memory. In an interview, give the HashSet idea first, then improve it.&lt;br/&gt;&lt;br/&gt;#ll012 · LL-012-A3
    </content>
    <updated>2026-10-14T10:08:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszqkqlfhuzqw7cfsrkax2qerqknjsshshel8dpx45vxawy0sealygzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvgmg30</id>
    
      <title type="html">Which is better for finding where a loop starts: a HashSet of ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszqkqlfhuzqw7cfsrkax2qerqknjsshshel8dpx45vxawy0sealygzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvgmg30" />
    <content type="html">
      Which is better for finding where a loop starts: a HashSet of visited nodes, or fast and slow pointers?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#ll012 · LL-012-Q3
    </content>
    <updated>2026-10-14T10:08:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs89zn7mdk2xlmhupue9rekltlmfla4jwarpjkwyl0jelh0jeszmpqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jaf2md6</id>
    
      <title type="html">Learn: Concurrency vs parallelism Concurrency: several tasks are ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs89zn7mdk2xlmhupue9rekltlmfla4jwarpjkwyl0jelh0jeszmpqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jaf2md6" />
    <content type="html">
      Learn: Concurrency vs parallelism&lt;br/&gt;&lt;br/&gt;Concurrency: several tasks are in progress at the same time, maybe taking turns on one core. Example: a server waiting on many database calls.&lt;br/&gt;Parallelism: work really runs at the same moment on several cores. Example: resizing 1,000 images.&lt;br/&gt;&lt;br/&gt;In .NET: waiting on I/O → async/await. CPU-heavy work → Parallel.For, or Task.Run in UI apps (on a server, Task.Run only moves work between pool threads). Both bring the same risk: shared data touched by two threads at once.&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-072
    </content>
    <updated>2026-10-14T09:37:56Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqswpffrxs6wgnzls8rxghgrqmwg73htv45qc9k8upze3s8k4sz779gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jct6w7d</id>
    
      <title type="html">Learn: Tree What: nodes in a hierarchy. One root at the top, each ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqswpffrxs6wgnzls8rxghgrqmwg73htv45qc9k8upze3s8k4sz779gzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jct6w7d" />
    <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-14T09:08:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqstnpz7kv6umf5xrj657nknr8pzsdvwtkj9sufrecszj0uxkmt6xjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jer56kn</id>
    
      <title type="html">Learn: Array What: items stored side by side in memory, each at ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqstnpz7kv6umf5xrj657nknr8pzsdvwtkj9sufrecszj0uxkmt6xjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jer56kn" />
    <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-14T08:38:05Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsvvtjd24t8n86qk3rn3gz439jng64phul3tx2564zmfdsn8n40cuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju7dm43</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;For the sum from index i to j, ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsvvtjd24t8n86qk3rn3gz439jng64phul3tx2564zmfdsn8n40cuqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38ju7dm43" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;For the sum from index i to j, you wrote prefix[j &#43; 1] - prefix[i]. Why j &#43; 1? Why not prefix[j] - prefix[i]?&amp;#34;&lt;br/&gt;&lt;br/&gt;Use prefix = { 0, 6, 8, 15, 16, 20 } and the range index 1 to 3.&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#arr016 · ARR-016-Q2
    </content>
    <updated>2026-10-14T08:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqszjtgwj9250njt5g99qfyjge35lk9y94rtlxfwahdlfue5nktjfegzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j650wa4</id>
    
      <title type="html">prefix[k] is the sum of the first k items: index 0 to k - 1. So ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqszjtgwj9250njt5g99qfyjge35lk9y94rtlxfwahdlfue5nktjfegzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j650wa4" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsvvtjd24t8n86qk3rn3gz439jng64phul3tx2564zmfdsn8n40cuqpz3mhxue69uhhyetvv9ujuerpd46hxtnfdurjkn8h&#39;&gt;nevent1q…kn8h&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;prefix[k] is the sum of the first k items: index 0 to k - 1. So prefix[j] stops just before index j.&lt;br/&gt;&lt;br/&gt;To include index j you need the first j &#43; 1 items. Then subtract the first i items.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Console.WriteLine(prefix[4] - prefix[1]); // index 1 to 3&lt;br/&gt;Console.WriteLine(prefix[3] - prefix[1]); // misses index 3&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;prefix[4] - prefix[1] = 10 = 2 &#43; 7 &#43; 1. prefix[3] - prefix[1] = 9 misses the item at index 3.&lt;br/&gt;&lt;br/&gt;#arr016 · ARR-016-A2
    </content>
    <updated>2026-10-14T08:08:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsdmf9zn2w5xhvdndp8ux5ul4jm3xtvxu9htjhply0hk86m7geeusqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmnml5l</id>
    
      <title type="html">Learn: Stack What: last in, first out. Push adds on top ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsdmf9zn2w5xhvdndp8ux5ul4jm3xtvxu9htjhply0hk86m7geeusqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jmnml5l" />
    <content type="html">
      Learn: Stack&lt;br/&gt;&lt;br/&gt;What: last in, first out. Push adds on top (amortized O(1): usually instant, sometimes the stack has to grow), Pop takes from the top in O(1).&lt;br/&gt;Use it when: you must undo or go back: undo in an editor, the browser back button, matching brackets, depth-first search.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var pairs = new Dictionary&amp;lt;char, char&amp;gt; { [&amp;#39;)&amp;#39;] = &amp;#39;(&amp;#39;, [&amp;#39;]&amp;#39;] = &amp;#39;[&amp;#39; };&lt;br/&gt;var stack = new Stack&amp;lt;char&amp;gt;();&lt;br/&gt;bool ok = true;&lt;br/&gt;foreach (char c in &amp;#34;([])&amp;#34;)&lt;br/&gt;    if (!pairs.ContainsKey(c)) stack.Push(c);&lt;br/&gt;    else ok &amp;amp;= stack.Count &amp;gt; 0 &amp;amp;&amp;amp; stack.Pop() == pairs[c];&lt;br/&gt;Console.WriteLine(ok &amp;amp;&amp;amp; stack.Count == 0);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints True: every closing bracket matched the last open one.&lt;br/&gt;&lt;br/&gt;Read more: &lt;a href=&#34;https://www.geeksforgeeks.org/dsa/stack-data-structure/&#34;&gt;https://www.geeksforgeeks.org/dsa/stack-data-structure/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#tip · TIP-027
    </content>
    <updated>2026-10-14T07:37:57Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsp4rrrkmxe7vmnvwg8pqumeyqxj07unc5uhg7e4skee257xsreknqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jv7g2nu</id>
    
      <title type="html">Learn: Sharding splits data by a key When one database is too big ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsp4rrrkmxe7vmnvwg8pqumeyqxj07unc5uhg7e4skee257xsreknqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jv7g2nu" />
    <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-14T07:08:02Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqspwpd9rrzclqn4a38pqrsxjn453qu0n0ec7m572ne7qujsfvejxcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvaydan</id>
    
      <title type="html">Learn: Brute force first, then improve If you don&amp;#39;t see the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqspwpd9rrzclqn4a38pqrsxjn453qu0n0ec7m572ne7qujsfvejxcgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvaydan" />
    <content type="html">
      Learn: Brute force first, then improve&lt;br/&gt;&lt;br/&gt;If you don&amp;#39;t see the best solution right away, say the simple one first, with its Big-O. For example: &amp;#34;Check every pair: O(n²).&amp;#34;&lt;br/&gt;&lt;br/&gt;Then ask yourself what work is repeated. A HashSet, sorting, or two pointers often removes it. A working slow answer beats an unfinished fast one.&lt;br/&gt;&lt;br/&gt;#tip · TIP-003
    </content>
    <updated>2026-10-14T06:38:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsy4cw74ql7xhxxue82unspc4xj7gnde8kne68d6wj4nhnllqefc8czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjrr3uq</id>
    
      <title type="html">Interviewer&amp;#39;s follow-up: &amp;#34;Find the shared node without ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsy4cw74ql7xhxxue82unspc4xj7gnde8kne68d6wj4nhnllqefc8czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jjrr3uq" />
    <content type="html">
      Interviewer&amp;#39;s follow-up: &amp;#34;Find the shared node without computing the lengths.&amp;#34;&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#ll011 · LL-011-Q3
    </content>
    <updated>2026-10-14T06:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsyxqs655xz6s9fwctf2ntg89hn008d49swty5xlfk72xk3kd5cjkqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jycspmc</id>
    
      <title type="html">Walk both lists, and when a pointer reaches the end, restart it ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsyxqs655xz6s9fwctf2ntg89hn008d49swty5xlfk72xk3kd5cjkqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jycspmc" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsy4cw74ql7xhxxue82unspc4xj7gnde8kne68d6wj4nhnllqefc8cpz3mhxue69uhhyetvv9ujuerpd46hxtnfduzgawuq&#39;&gt;nevent1q…awuq&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Walk both lists, and when a pointer reaches the end, restart it at the head of the other list.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;Node shared = Build(8, 9);&lt;br/&gt;Node a = new(1, new(2, new(3, shared))), b = new(5, shared);&lt;br/&gt;Node? p = a, q = b;&lt;br/&gt;while (p != q)&lt;br/&gt;{&lt;br/&gt;    p = p == null ? b : p.Next;&lt;br/&gt;    q = q == null ? a : q.Next;&lt;br/&gt;}&lt;br/&gt;Console.WriteLine(p?.Value);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 8. Each pointer walks lenA &#43; lenB steps in total, so they arrive at the shared part at the same moment.&lt;br/&gt;&lt;br/&gt;No shared node? Then both reach null after lenA &#43; lenB steps, together. p == q (both null), and the loop ends.&lt;br/&gt;&lt;br/&gt;#ll011 · LL-011-A3
    </content>
    <updated>2026-10-14T06:08:01Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsput5psyv7wklu2382xpps8zvad8mupmaa3xqzuu6c5wxksc7ql9szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j65thl0</id>
    
      <title type="html">Learn: Costs worth knowing by heart Read array[i]: O(1) Search an ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsput5psyv7wklu2382xpps8zvad8mupmaa3xqzuu6c5wxksc7ql9szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j65thl0" />
    <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-14T05:38:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsqcqeafdjxlkqh77q3cdx2r7n33p5u3gu8ppy2w4rxy6265gzmcrszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7zz7y3</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.cloud.vinney.xyz/nevent1qqsqcqeafdjxlkqh77q3cdx2r7n33p5u3gu8ppy2w4rxy6265gzmcrszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j7zz7y3" />
    <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-14T05:07:58Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsr837f2g87zjfsqdmtk9u0cddctl5pjtx0sctrfd5cnjfaj2jhtcszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jlnma2k</id>
    
      <title type="html">Learn: Linear search What: check the items one by one until you ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/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.cloud.vinney.xyz/nevent1qqs27e776njesgdvg0v4yj5dp9msecywf9slt8dsc4c2w4pr32g5kzszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jm602jv</id>
    
      <title type="html">Store each result the first time you compute it, and return the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs27e776njesgdvg0v4yj5dp9msecywf9slt8dsc4c2w4pr32g5kzszyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jm602jv" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsgr85rp7ccp9sj927uz2dgh03nudqtsk4wy34vtf9rce9t0dm5cvqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduaph6m5&#39;&gt;nevent1q…h6m5&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;Store each result the first time you compute it, and return the stored value next time. This is called memoization.&lt;br/&gt;&lt;br/&gt;```csharp&lt;br/&gt;var memo = new long[51];&lt;br/&gt;Console.WriteLine(Fib(50));&lt;br/&gt;&lt;br/&gt;long Fib(int n)&lt;br/&gt;{&lt;br/&gt;    if (n &amp;lt; 2) return n;&lt;br/&gt;    if (memo[n] != 0) return memo[n];&lt;br/&gt;    return memo[n] = Fib(n - 1) &#43; Fib(n - 2);&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;It prints 12586269025 at once. Each value is computed once: O(n) time. Memory: O(n) for the array, plus O(n) for the recursion depth.&lt;br/&gt;&lt;br/&gt;#big011 · BIG-011-A2
    </content>
    <updated>2026-10-13T18:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgr85rp7ccp9sj927uz2dgh03nudqtsk4wy34vtf9rce9t0dm5cvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrpp4f7</id>
    
      <title type="html">Question: Make Fib fast by remembering results you already ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgr85rp7ccp9sj927uz2dgh03nudqtsk4wy34vtf9rce9t0dm5cvqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrpp4f7" />
    <content type="html">
      Question: Make Fib fast by remembering results you already computed. What are the new time and memory?&lt;br/&gt;&lt;br/&gt;Try to answer before you open the reply.&lt;br/&gt;&lt;br/&gt;#big011 · BIG-011-Q2
    </content>
    <updated>2026-10-13T18:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsx52qnreu0ymfzlz209xwpfzwww0f2ua7k6r2ywe735se3j8wge4czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jym0j9r</id>
    
      <title type="html">Learn: Bitwise tricks Operators: &amp;amp; (and), | (or), ^ (xor), ~ ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsx52qnreu0ymfzlz209xwpfzwww0f2ua7k6r2ywe735se3j8wge4czyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jym0j9r" />
    <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-13T17:38:03Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs8ra9fvd98sa8han53th7e7m0rrmkdll38jl4qyjnjwqe6lkew20szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrclyu9</id>
    
      <title type="html">Learn: Starvation Starvation: a thread is ready to work but never ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs8ra9fvd98sa8han53th7e7m0rrmkdll38jl4qyjnjwqe6lkew20szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jrclyu9" />
    <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-13T17:08:04Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsgsm9v0q8um9th707kf58q4z8ql59c050gspm9ullkzhjckkghpfgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3u4gxc</id>
    
      <title type="html">Learn: Merge sort, step by step How merge sort splits, sorts and ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsgsm9v0q8um9th707kf58q4z8ql59c050gspm9ullkzhjckkghpfgzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38j3u4gxc" />
    <content type="html">
      In reply to &lt;a href=&#39;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vfn2scnjvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsyg8x3gy9d6gdnxtmraepayzjfxykgyka2upen2v8kt506hnlel3z0ypsgqqqw4rs9a473e&#39;&gt;naddr1qq…473e&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;/naddr1qqt4gj2s95crxd6qxgcryd3dxycz6vfn2scnjvesqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqz9nhwden5te0wfjkccte9ec8y6tdv9kzumn9wspzpe52pptwjrvej7clwg0fq5jf39jp9h2hqwv6npajar74ul70ugneqvzqqqr4gud50mf9&#34; class=&#34;bg-lavender dark:prose:text-neutral-50 dark:text-neutral-50 dark:bg-garnet px-1&#34;&gt;naddr1qq…0mf9&lt;/a&gt;&lt;/span&gt;&lt;br/&gt; &lt;/div&gt; 
&lt;h2 id=&#34;merge-sort-step-by-step-8&#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-8&#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-8&#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-17&#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-8&#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-13T16:37:57Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqsyjpq82xugkwqx6wxt430p0u345sc9339z8v7qsp8zsu0u3ls4x7szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvf3gmx</id>
    
      <title type="html">Learn: Ask before you code Before writing anything, ask about the ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqsyjpq82xugkwqx6wxt430p0u345sc9339z8v7qsp8zsu0u3ls4x7szyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jvf3gmx" />
    <content type="html">
      Learn: Ask before you code&lt;br/&gt;&lt;br/&gt;Before writing anything, ask about the input:&lt;br/&gt;&lt;br/&gt;Can it be empty or null?&lt;br/&gt;Are there duplicates or negative numbers?&lt;br/&gt;Is it sorted?&lt;br/&gt;How big can it get?&lt;br/&gt;&lt;br/&gt;The answers often change the best solution, and asking shows the interviewer you think about edge cases.&lt;br/&gt;&lt;br/&gt;#tip · TIP-002
    </content>
    <updated>2026-10-13T16:08:00Z</updated>
  </entry>

  <entry>
    <id>https://njump.cloud.vinney.xyz/nevent1qqs8a7hpv58kpmzhh56aew2pgqfescpagey040y4v6ddsv80d77krjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdv5rs0</id>
    
      <title type="html">Learn: The lock statement lock lets only one thread at a time run ...</title>
    
    <link rel="alternate" href="https://njump.cloud.vinney.xyz/nevent1qqs8a7hpv58kpmzhh56aew2pgqfescpagey040y4v6ddsv80d77krjqzyrng5zzkayxen9a37us7jpfynztyztw4wque4xrm968atelulc38jdv5rs0" />
    <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-13T15:38:03Z</updated>
  </entry>

</feed>