JZLeetCode
RSS FeedHigh quality leet code solutions in Java, Python, C++, and Rust.
Comment in the Disqus section at the bottom of every post (you may have to refresh) if you have any questions. You can also share the solution on social media with the buttons at the bottom left of each post.
Please add a note that your reference or source is @JZLeetCode.
Social links for BuyMeCoffee and Discord server is below and at the bottom right of every post. Donations and discussions are greatly appreciated and welcomed.
Read the blog posts or check About for more info.
Featured
LeetCode 658 LintCode 460 Find K Closest Elements
Published: at 06:23 AMSolutions for LeetCode 658 LintCode 460, medium, tags: array, binary-search, sliding-window, sorting, heap; companies: google.
LeetCode 2539 LintCode 3855 Count the Number of Good Subsequences
Published: at 06:23 AMSolutions for LeetCode 2539 LintCode 3855, hard, tags: enumerate, string, hash table, math, combinatorics, counting.
System Design - How do Websockets Work
Published: at 06:23 AMHow do websockets work comparing to http?
LeetCode 2450 LintCode 3841 Number of Distinct Binary Strings After Applying Operations
Updated: at 06:23 AMSolutions for LeetCode 2450 LintCode 3841, medium, tags: math, string.
LeetCode 206 LintCode 35 Reverse Linked List
Published: at 06:23 AMSolutions for LeetCode 206 LintCode 35, easy, tags: linked list, recursion; companies: bytedance.
LeetCode 1166 LintCode 3677 Design File System
Published: at 06:23 AMSolutions for LeetCode 1166 LintCode 3677, medium, tags: hash table, trie, string, design.
How could we interview job candidates to find the right teammates? Why should we care?
Updated: at 10:12 AMhow should we interview other job candidates to find the teammates we like? tips and suggestions on how to interview teammate or junior engineers.
LeetCode 2017 Grid Game
Published: at 06:23 AMSolutions for LeetCode 2017, medium, tags: array, prefix sum, dynamic programming, matrix.
LeetCode 542 LintCode 974 01 Matrix and LeetCode 1765 Map of Highest Peak
Published: at 06:23 AMSolutions for LeetCode 542, LeetCode 1765, and LintCode 974, hard, tags: array, queue, sliding window, heap, monotonic queue.
LeetCode 532 LintCode 1187 K-diff Pairs in An Array
Published: at 06:23 AMSolutions for LeetCode 532 LintCode 1187, medium, tags: array, hash table, counting, two-pointers, binary-search; companies: nvidia, amazon.
LeetCode Meeting Rooms Derivative Question
Published: at 06:23 AMSolutions for meeting rooms derivative question, hard, tags: heap, line sweep, ordered map; companies: salesforce.
LeetCode 1400 Construct K Palindrome Strings
Published: at 06:23 AMSolutions for LeetCode 1400, medium, tags: hash table, string, greedy, counting.
LeetCode 916 LintCode 1726 Word Subsets
Published: at 06:23 AMSolutions for LeetCode 916 LintCode 1726, medium, tags: array, hash table, string.
System Design - Event Loop for Concurrent Applications
Published: at 06:23 AMevent loop system design pattern/construct event loop (message dispatcher), reactor/actor pattern, non-blocking mechanism for concurrent applications
LeetCode 1930 Unique Length-3 Palindromic Subsequences
Published: at 06:23 AMSolutions for LeetCode 1930, medium, tags: hash table, string, bit manipulation, prefix sum.
HackerRank and GeeksForGeeks Minimum Replacements/Substitutions to Make Adjacent Characters Unequal
Published: at 06:23 AMSolutions for , easy, tags: array, sliding window; companies: salesforce.
LeetCode 2559 Count Vowel Strings in Ranges
Published: at 06:23 AMSolutions for LeetCode 2559, medium, tags: array, string, prefix-sum.
LeetCode 1422 Maximum Score After Splitting a String
Published: at 06:23 AMSolutions for LeetCode 1422, easy, tags: string, prefix sum.
HackerRank Programmer Strings
Published: at 06:23 AMSolutions for HackerRank Programmer Strings, hard, tags: string, hash table.
LeetCode 2466 LintCode 3854 Count Ways to Build Good Strings (Number of Good Binary Strings)
Published: at 06:23 AMSolutions for LeetCode 2466 LintCode 3854, medium, tags: array, dynamic programming.
Java CheatSheet
Updated: at 10:12 AMtips for using java
LeetCode 875 LintCode 1492 Koko Eating Bananas
Published: at 06:23 AMSolutions for LeetCode 875 LintCode 1492, medium, tags: array, binary search; companies: facebook, salesforce.
LeetCode 423 LintCode 1247 Reconstruct Original Digits from English
Published: at 06:23 AMSolutions for LeetCode 423 LintCode 1247, medium, tags: hash table, simulation, math, string.
LeetCode 2415 Reverse Odd Levels of Binary Tree
Published: at 06:23 AMSolutions for LeetCode 239, hard, tags: array, queue, sliding window, heap, monotonic queue.
LintCode 2503 Thread Safe Counter (Concurrency)
Published: at 06:23 AMSolutions for LintCode 2503, tags: lock, re-entrant lock.
LeetCode 691 LintCode 1081 Stickers to Spell Word
Published: at 06:23 AMSolutions for LeetCode 239, hard, tags: array, queue, sliding window, heap, monotonic queue.
LeetCode 339 LintCode 551 Nested List Weight Sum
Published: at 07:23 AMSolutions for LeetCode 339 LintCode 551, medium, tags: dfs, bfs; companies: salesforce.
Analyze Recursive Algorithm Time Complexity for LeetCode Questions with Substitution, Recursion Tree and Master Theorem
Published: at 06:23 AMAnalyze Recursive Algorithm Time Complexity for LeetCode Questions with Substitution, Recursion Tree and Master Theorem
Generative AI (Artificial Intelligence) with Large Language Models (LLM) - Part 1
Updated: at 10:12 AMgenerative AI (artificial intelligence) machine learning with large language models
LeetCode 994 LintCode 3726 Rotting Oranges
Published: at 06:23 AMSolutions for LeetCode 994 LintCode 3726, medium, tags: graph, bfs, array; companies: tiktok.
LeetCode 520 LintCode 1202 IPO
Published: at 06:23 AMSolutions for LeetCode 520 LintCode 1202, hard, tags: array, heap, greedy, sorting, binary search, dynamic programming, quick select.
Rust Option, Rc, and RefCell Explained - LeetCode Tree Node and LinkedList Node
Published: at 07:23 AMExplanation for rust data structure for tree node and linked list node. What is Rc and RefCell? Why Option<Rc<RefCell>>> three wrappers? How to avoid circular reference?
LeetCode 2558 Take Gifts From the Richest Pile
Published: at 06:23 AMSolutions for LeetCode 2558, easy, tags: array, heap, simulation.
LeetCode 713 LintCode 1075 Subarray Product Less Than K
Published: at 06:23 AMSolutions for LeetCode 713 and LintCode 1075, medium, tags: sliding window, two pointers, prefix sum; companies: salesforce, yatra.
LeetCode 1650 LintCode 474 Lowest Common Ancestor of a Binary Tree III
Published: at 07:23 AMSolutions for LeetCode 1650 LintCode 474, medium, tags: binary tree, hash table, two pointers; companies: microsoft.
LeetCode 408 LintCode 637 Valid Word Abbreviation
Published: at 06:23 AMSolutions for LeetCode 408 LintCode 637, easy, tags: two pointers, string, companies: facebook, google.
HackerRank GET Requests for GIF Images
Published: at 06:23 AMSolutions for hacker rank get requests for gif images, medium, tags: file, hash set.
LintCode 26 Inner Product
Published: at 06:23 AMSolutions for LintCode 26, hard, tags: dynamic programming.
How to Draw Circles and Arcs with Python Library Matplotlib
Updated: at 10:12 AMtips for matplotlib python draw arcs, robot walks, project euler 208
LeetCode 540 LintCode 1183 Single Element in a Sorted Array
Published: at 06:23 AMSolutions for LeetCode 540 LintCode 1183, medium, tags: array, binary search.
Linux Cheatsheet, tips and Commands
Updated: at 10:12 AMtips for linux commands and tips
LeetCode 1 LintCode 56 Two Sum
Published: at 06:23 AMSolutions for LeetCode 1 LintCode 56, easy, tags: array, hash table.
HackerRank Robot Walks and Project Euler 208 Solutions
Published: at 06:23 AMSolutions for project euler 208 and hackerrank question robot walks, hard, tags: math, simulation.
How to Install SortedContainers in the Python Shell or With a Python Script
Updated: at 10:12 AMtips for installing sortedcontainers in a python shell
LeetCode 53 LintCode 41 Maximum Subarray
Published: at 08:23 AMSolutions for LeetCode 53 and LintCode 41, medium, tags: array, divide and conquer, dynamic programming, prefix sum, companies: ltk.
LeetCode 1041 LintCode 1345 Robot Bounded in Circle (GeeksForGeeks, HackerRank EnCircular)
Published: at 07:23 AMSolutions for LeetCode 1041 LintCode 1345 GFG HackerRank, medium, tags: math, string, simulation, companies: linkedin, salesforce.
LintCode 3127 How Many Times is Two Squared?
Published: at 06:23 AMSolutions for LintCode 3127, easy, tags: math, bit.
LeetCode 1346 Check If N and Its Double Exist
Published: at 06:23 AMSolutions for LeetCode 1346, easy, tags: array, hash table, two pointers, binary search, sorting.
LeetCode 91 Decode Ways and Hacker Rank ASCII Encoded Strings (VMWare, Goldman Sachs, and Salesforce Interview Questions)
Published: at 07:23 AMSolutions for LeetCode 91, medium, tags: string, dynamic programming, companies: goldman sachs, vmware, salesforce.
Cheatsheet for Math Knowledge Needed for LeetCode Algorithm Questions (Geometric Series and Arithmetic Progression Sum)
Published: at 06:23 AMcheatsheet for math knowledge needed for leetcode algorithm questions, geometric series sum
HackerRank Bitwise Xor Operations
Published: at 08:23 AMSolutions for hackerrank bitwise xor operations, medium, tags: bit, companies: salesforce.
Fun Bit Tricks (Manipulations)
Published: at 10:23 AMFun bitwise tricks such as count set bits, negate, ilog2, xor swap, .etc.
LeetCode 3167 HackerRank Better Compression
Published: at 07:23 AMSolutions for LeetCode 3167 HackerRank Better Compression, tags: string, hash table, companies: salesforce.
LeetCode 214 LintCode 678 Shortest Palindrome (GeeksForGeeks Minimum Insertion to Form Shortest Palindrome)
Published: at 06:23 AMSolutions for LeetCode 239, LintCode 678, medium, tags: two pointers, string, kmp, rabin-karp, rolling hash.
LeetCode 146 LintCode 134 LRU Cache
Published: at 09:23 AMSolutions for LeetCode 146 LintCode 134, medium, tags: hash, linked list, design, doubly linked list, companies: amazon, openai.
LeetCode 487 LintCode 883 Max Consecutive Ones II
Published: at 08:23 AMSolutions for LeetCode 487, LintCode 833, medium, tags: array, dynamic programming, sliding window, two pointers, companies: google.
LeetCode 1 Similar Two Subtract Count
Published: at 07:23 AMSolutions for LeetCode 1 similar, medium, tags: array, hash table, companies: salesforce.
LeetCode 811 LintCode 1006 Subdomain Visit Count
Published: at 06:23 AMSolutions for LeetCode 811 and LintCode 1006, medium, tags: array, hash, string, counting, companies: salesforce.
LeetCode 1804 LintCode 3729 Implement Trie II
Updated: at 09:23 AMSolutions for LeetCode 1804 LintCode 3729, medium, tags: design, trie, hash, string.
Reverse of LeetCode 38 LintCode 420 Count and Say (Look and Say)
Updated: at 08:23 AMSolutions for LeetCode 38, LintCode 420, medium, tags: math, string, simulation, companies: facebook, pinterest.
LeetCode 38 LintCode 420 Count and Say (Look and Say)
Updated: at 07:23 AMSolutions for LeetCode 38, LintCode 420, medium, tags: math, string, simulation, companies: facebook, pinterest.
How to Embed an SVG Image/Picture with the Code or File on a Website
Published: at 03:23 AMthree main ways to embed an SVG image or picture as a file or using html code on a website
Vim CheatSheet
Updated: at 10:12 AMtips for using vim
LeetCode 465 LintCode 707 Optimal Account Balancing
Updated: at 07:24 AMSolutions for LeetCode 465 LintCode 707, hard, tags: bit, array, dynamic programming, backtracking, bitmask.
Elevator Closest Floors (Shortest Path, Related to Shortest Seek Time First Disk Seek Algorithm)
Updated: at 07:23 AMSolutions for Elevator Shortest Path, medium, tags: array, binary search.
LeetCode 2461 Maximum Sum of Distinct Subarrays With Length K
Published: at 07:23 AMSolutions for LeetCode 2461, medium, tags: array, sliding window, hash.
LeetCode 1055 LintCode 3652 Shortest Way to Form String
Published: at 05:23 AMSolutions for LeetCode 1055 LintCode 3652, hard, tags: greedy, two pointers, string.
LintCode 2894 Order by frequency
Updated: at 07:22 AMSolutions for LintCode 2894, medium, tags: map, sort. Related to LeetCode 884 and 451.
LeetCode 125 LintCode 415 Valid Palindrome
Updated: at 08:12 AMSolutions for LeetCode 125, LintCode 415, easy, tags: two pointers, string. Companies: LinkedIn, Facebook, Uber, Zenefits, Microsoft.
LeetCode 314 LintCode 651 Binary Tree Vertical Order Traversal
Updated: at 10:12 AMsolutions for LeetCode 314 LintCode 651 Binary Tree Vertical Order Traversal, tags: hash, bfs, tree, companies: facebook google
LeetCode 1192 LintCode 1271 Critical Connections in a Network
Updated: at 10:12 AMsolutions for LeetCode 1192, LintCode 1271, hard, tags: dfs, graph, bi-connected component. Companies: Amazon.
LeetCode 239 LintCode 362 Sliding Window Maximum
Updated: at 10:12 AMsolutions for LeetCode 239, LintCode 362, hard, tags: array, queue, sliding window, heap, monotonic queue. Companies: Amazon, Zenefits, Microsoft, Google.
LeetCode 20 LintCode 423 Valid Parentheses (stack)
Updated: at 05:12 PMsolution for LeetCode 20 LintCode 423 valid parentheses, tags: stack, string; companies: goldman sachs, twitter, airbnb, amazon, facebook, microsoft, bloomberg, uber, google.
Recent Posts
AWS (Amazon Web Services) Tips and Cheatsheet
Updated: at 10:12 AMtips for using AWS
LeetCode 2257 Count Unguarded Cells in the Grid
Updated: at 07:23 AMSolutions for LeetCode 2257, medium, tags: array, graph, simulation.
How to Mark All as Read for Google Voice
Updated: at 10:12 AMtips for using google voice, mark all as read
LeetCode 1652 Defuse the Bomb
Updated: at 07:22 AMSolutions for LeetCode 1652, easy, tags: array, sliding window.