Stories, Tutorials
& Life Tips
Deep dives on coding, health, recipes, travel and everything in between.
📍 Explore Reading Paths
Follow curated journeys from beginner to expert
Maximum Depth of Binary Tree - Tree - Easy - LeetCode
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Note: A leaf is a node with no children.…
Same Tree - Tree - Easy - LeetCode
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same …
Number of Steps to Reduce a Number to Zero - Bit Manipulation - Easy - LeetCode
Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you ha…
Prime Number of Set Bits in Binary Representation - Bit Manipulation - Easy - LeetCode
Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits …
Binary Number with Alternating Bits - Bit Manipulation - Easy - LeetCode
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different…
Number Complement - Bit Manipulation - Easy - LeetCode
Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary re…
Hamming Distance - Bit Manipulation - Easy - LeetCode
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Give…
Convert a Number to Hexadecimal - Bit Manipulation - Easy - LeetCode
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method i…
Power of Four - Easy - LeetCode
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16Output: tru…
Number of 1 Bits - Easy - LeetCode
Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weig…
Reverse Bits - Bit Manipulation - Easy - LeetCode
Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100Output: 00111…
Shuffle String - Sort - Easy - LeetCode
Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character …
Sort Integers by The Number of 1 Bits - Sort - Easy - LeetCode
Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their …
Matrix Cells in Distance Order - Sort - Easy - LeetCode
We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 …
Water Bottles - Greedy - Easy - LeetCode
Given numBottles full water bottles, you can exchange numExchange empty water bottles for one full water bottle. The ope…