Byju's Coding Interview Questions
25 Byju's coding interview problems with full optimal solutions — 10 easy, 11 medium, 4 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Byju's interviewer values, and a FAQ section.
Showing 25 problems of 25
- #1easyfoundational
1. Two Sum
Given an array of integers, return indices of two numbers adding to a target.
- #2easyfoundational
2. Valid Parentheses
Determine whether a string of brackets is correctly balanced and nested.
- #3easyfoundational
3. Merge Two Sorted Lists
Merge two sorted singly linked lists into one sorted list by splicing nodes.
- #4easyfoundational
4. Maximum Depth of Binary Tree
Return the depth of a binary tree, measuring the longest root-to-leaf path.
- #5easyfoundational
5. Best Time to Buy and Sell Stock
Maximize profit from one buy and one sell across an array of daily prices.
- #6easyfoundational
6. Single Number
Find the lone integer in an array where every other number appears twice.
- #7easyfoundational
7. Min Stack
Design a stack supporting push, pop, top, and O(1) minimum retrieval.
- #8easyfoundational
8. Majority Element
Find the element appearing more than n/2 times in an array.
- #9easyfoundational
9. Reverse Linked List
Reverse a singly linked list in place.
- #10easyfoundational
10. Invert Binary Tree
Mirror a binary tree by swapping left and right children at every node.
- #11mediumfoundational
11. Binary Tree Level Order Traversal
Return the node values of a binary tree grouped by level.
- #12mediumfoundational
12. LRU Cache
Design an O(1) get/put cache that evicts the least-recently-used key when full.
- #13mediumfoundational
13. Binary Tree Right Side View
Return the rightmost node visible at each level of a binary tree.
- #14mediumfoundational
14. Number of Islands
Count connected land regions in a 2D grid of '1' (land) and '0' (water).
- #15mediumfoundational
15. Course Schedule
Decide whether a set of prerequisite-linked courses can all be finished.
- #16mediumfoundational
16. Implement Trie (Prefix Tree)
Build a Trie supporting insert, search, and startsWith on lowercase strings.
- #17mediumfoundational
17. Kth Largest Element in an Array
Return the kth largest element in an unsorted array without fully sorting it.
- #18mediumfoundational
18. Product of Array Except Self
Return an array where each index holds the product of every other element, without division.
- #19mediumfoundational
19. Top K Frequent Elements
Return the k most frequent values in an integer array.
- #20mediumfoundational
20. Subarray Sum Equals K
Count the number of contiguous subarrays whose sum equals k.
- #21mediumfoundational
21. Daily Temperatures
For each day in an array, return how many days until a warmer temperature occurs.
- #22hardfoundational
22. Sliding Window Maximum
Return the max of every contiguous window of size k as it slides across the array.
- #23hardfoundational
23. Find Median from Data Stream
Design a streaming data structure that returns the running median.
- #24hardfoundational
24. Serialize and Deserialize Binary Tree
Convert a binary tree to a string and reconstruct the identical tree from that string.
- #25hardfoundational
25. Split Array Largest Sum
Partition an array into k contiguous subarrays so the maximum subarray sum is minimized.