MeldenCodeWithWho@CodeWithWhoBuilding software that solves real problems. Software Engineer | Frontend | Backend Shipping ideas to the internet.https://t.co/coDfAjyBAeBeigetreten März 2026158 Gefolgt97 Follower934 BeiträgeBeiträgeMedienCodeWithWho@CodeWithWho·7moYesterday I wore an article on how my last week went Its is posted on LinkedInTeilenKopiert017247CodeWithWho@CodeWithWho·3dTaking every customer from one list and rescanning a huge second dataset each time works, but it scales badly. #softwareengineering #algorithms Watch:HerunterladenTeilenKopiert000CodeWithWho@CodeWithWho·3dIntersection means unique common values. If 3 is already in the result, another 3 should not be added again. #arrays #algorithms Watch:HerunterladenTeilenKopiert0003CodeWithWho@CodeWithWho·3dOnce A[i] matches something in B, existence is confirmed. Add it and stop scanning for that candidate. #algorithms #python Watch:HerunterladenTeilenKopiert0002CodeWithWho@CodeWithWho·4dOne value from A can force a full scan of B when no match exists. That's where repeated work begins. #algorithms #optimization Watch:HerunterladenTeilenKopiert0007CodeWithWho@CodeWithWho·4dBrute force: take one unique value from A, scan B for a match, add it if found, then repeat. #algorithms #arrays Watch:HerunterladenTeilenKopiert0005CodeWithWho@CodeWithWho·4dAlgorithm choice depends on data shape. 1M vs 1M and 100 vs 10M may deserve completely different strategies. #softwareengineering #algorithms Watch:HerunterladenTeilenKopiert00113CodeWithWho@CodeWithWho·4dn << m could mean 100 values vs 1,000,000. Same problem, very different data shape. #algorithms #optimization Watch:HerunterladenTeilenKopiert0007CodeWithWho@CodeWithWho·4dn ≈ m means roughly the same scale, not exactly equal. Example: 1,000 vs 1,200 elements. #algorithms Watch:HerunterladenTeilenKopiert0005CodeWithWho@CodeWithWho·5dIf the problem tells you the arrays are sorted, use that information. Sorted order can eliminate unnecessary work. #algorithms #optimization Watch:HerunterladenTeilenKopiert0005CodeWithWho@CodeWithWho·5dArray intersection = values that exist in both A and B, with no duplicates in the result. #algorithms #arrays Watch:HerunterladenTeilenKopiert0027CodeWithWho@CodeWithWho·5dBrute force remembers used positions. Hashing remembers remaining quantity. The better representation removes repeated discovery. #optimization #hashtables Watch:HerunterladenTeilenKopiert0004CodeWithWho@CodeWithWho·6dEvery character in L may scan all of M: O(l × m), or roughly O(n²) when both inputs are similar in size. #bigO #algorithms Watch:HerunterladenTeilenKopiert00017CodeWithWho@CodeWithWho·6dBrute force repeatedly searches M. Hashing builds inventory once and consumes it. Same answer, much less repeated work. #algorithms #hashtables Watch:HerunterladenTeilenKopiert0004CodeWithWho@CodeWithWho·6dCount already 0? Fail immediately. Same logic applies to stock, seats, credits and quotas in real systems. #softwareengineering #hashtables Watch:HerunterladenTeilenKopiert0027CodeWithWho@CodeWithWho·6dSecond 'a'? No search. Read char_count['a'], decrement, continue. That's the hash-table advantage. #optimization #hashtables Watch:HerunterladenTeilenKopiert0003CodeWithWho@CodeWithWho·6dLetter demand just decrements inventory: a 2→1, b 1→0. No magazine rescan. #algorithms #hashtables Watch:HerunterladenTeilenKopiert0007CodeWithWho@CodeWithWho·7dOptimized debugger: watch the current char and char_count. Those two values show supply being built and consumed. #python #debugging Watch:HerunterladenTeilenKopiert0001CodeWithWho@CodeWithWho·7dM='aabc' becomes a→2, b→1, c→1 in the debugger. Supply is built once before demand starts. #python #hashtables Watch:HerunterladenTeilenKopiert0002CodeWithWho@CodeWithWho·7dTicket inventory uses the same idea: Standard→120, VIP→15, then bookings consume the counts. Resource → quantity → demand. #softwareengineering Watch:HerunterladenTeilenKopiert0005CodeWithWho@CodeWithWho·7dCount already zero and demand asks for another unit? Fail immediately. No need to search for inventory we already know is gone. #hashtables #optimization Watch:HerunterladenTeilenKopiert0003
CodeWithWho@CodeWithWho·7moYesterday I wore an article on how my last week went Its is posted on LinkedInTeilenKopiert017247
CodeWithWho@CodeWithWho·3dTaking every customer from one list and rescanning a huge second dataset each time works, but it scales badly. #softwareengineering #algorithms Watch:HerunterladenTeilenKopiert000
CodeWithWho@CodeWithWho·3dIntersection means unique common values. If 3 is already in the result, another 3 should not be added again. #arrays #algorithms Watch:HerunterladenTeilenKopiert0003
CodeWithWho@CodeWithWho·3dOnce A[i] matches something in B, existence is confirmed. Add it and stop scanning for that candidate. #algorithms #python Watch:HerunterladenTeilenKopiert0002
CodeWithWho@CodeWithWho·4dOne value from A can force a full scan of B when no match exists. That's where repeated work begins. #algorithms #optimization Watch:HerunterladenTeilenKopiert0007
CodeWithWho@CodeWithWho·4dBrute force: take one unique value from A, scan B for a match, add it if found, then repeat. #algorithms #arrays Watch:HerunterladenTeilenKopiert0005
CodeWithWho@CodeWithWho·4dAlgorithm choice depends on data shape. 1M vs 1M and 100 vs 10M may deserve completely different strategies. #softwareengineering #algorithms Watch:HerunterladenTeilenKopiert00113
CodeWithWho@CodeWithWho·4dn << m could mean 100 values vs 1,000,000. Same problem, very different data shape. #algorithms #optimization Watch:HerunterladenTeilenKopiert0007
CodeWithWho@CodeWithWho·4dn ≈ m means roughly the same scale, not exactly equal. Example: 1,000 vs 1,200 elements. #algorithms Watch:HerunterladenTeilenKopiert0005
CodeWithWho@CodeWithWho·5dIf the problem tells you the arrays are sorted, use that information. Sorted order can eliminate unnecessary work. #algorithms #optimization Watch:HerunterladenTeilenKopiert0005
CodeWithWho@CodeWithWho·5dArray intersection = values that exist in both A and B, with no duplicates in the result. #algorithms #arrays Watch:HerunterladenTeilenKopiert0027
CodeWithWho@CodeWithWho·5dBrute force remembers used positions. Hashing remembers remaining quantity. The better representation removes repeated discovery. #optimization #hashtables Watch:HerunterladenTeilenKopiert0004
CodeWithWho@CodeWithWho·6dEvery character in L may scan all of M: O(l × m), or roughly O(n²) when both inputs are similar in size. #bigO #algorithms Watch:HerunterladenTeilenKopiert00017
CodeWithWho@CodeWithWho·6dBrute force repeatedly searches M. Hashing builds inventory once and consumes it. Same answer, much less repeated work. #algorithms #hashtables Watch:HerunterladenTeilenKopiert0004
CodeWithWho@CodeWithWho·6dCount already 0? Fail immediately. Same logic applies to stock, seats, credits and quotas in real systems. #softwareengineering #hashtables Watch:HerunterladenTeilenKopiert0027
CodeWithWho@CodeWithWho·6dSecond 'a'? No search. Read char_count['a'], decrement, continue. That's the hash-table advantage. #optimization #hashtables Watch:HerunterladenTeilenKopiert0003
CodeWithWho@CodeWithWho·6dLetter demand just decrements inventory: a 2→1, b 1→0. No magazine rescan. #algorithms #hashtables Watch:HerunterladenTeilenKopiert0007
CodeWithWho@CodeWithWho·7dOptimized debugger: watch the current char and char_count. Those two values show supply being built and consumed. #python #debugging Watch:HerunterladenTeilenKopiert0001
CodeWithWho@CodeWithWho·7dM='aabc' becomes a→2, b→1, c→1 in the debugger. Supply is built once before demand starts. #python #hashtables Watch:HerunterladenTeilenKopiert0002
CodeWithWho@CodeWithWho·7dTicket inventory uses the same idea: Standard→120, VIP→15, then bookings consume the counts. Resource → quantity → demand. #softwareengineering Watch:HerunterladenTeilenKopiert0005
CodeWithWho@CodeWithWho·7dCount already zero and demand asks for another unit? Fail immediately. No need to search for inventory we already know is gone. #hashtables #optimization Watch:HerunterladenTeilenKopiert0003