1,724 articles across 10 categories

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
Featured

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.

1 min read6 Oct 2020
Read article
Same Tree - Tree - Easy - LeetCode

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

1 min6 Oct
Number of Steps to Reduce a Number to Zero - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Prime Number of Set Bits in Binary Representation - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Binary Number with Alternating Bits - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Number Complement - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Hamming Distance - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Convert a Number to Hexadecimal - Bit Manipulation - Easy - LeetCode

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

1 min6 Oct
Power of Four - Easy - LeetCode

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

1 min5 Oct
Number of 1 Bits - Easy - LeetCode

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

1 min5 Oct
Reverse Bits - Bit Manipulation - Easy - LeetCode

Reverse Bits - Bit Manipulation - Easy - LeetCode

Reverse bits of a given 32 bits unsigned integer.   Example 1: Input: 00000010100101000001111010011100Output: 00111

1 min5 Oct
Shuffle String - Sort - Easy - LeetCode

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

1 min5 Oct
Sort Integers by The Number of 1 Bits - Sort - Easy - LeetCode

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

1 min5 Oct
Matrix Cells in Distance Order - Sort - Easy - LeetCode

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

1 min5 Oct
Water Bottles - Greedy - Easy - LeetCode

Water Bottles - Greedy - Easy - LeetCode

Given numBottles full water bottles, you can exchange numExchange empty water bottles for one full water bottle. The ope

1 min5 Oct