Coding Round Interview Questions

Click “Show answer” to reveal the solution and explanation. Use the filter or the pattern shortcuts to find common techniques quickly.

Showing 21 of 21
  1. Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.
  2. Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
  3. Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.
  4. Given a linked list, determine if it has a cycle in it.
  5. Given a binary tree, find its maximum depth.
  6. Given a string, find the first non-repeated character in it.
  7. Given an array of integers, find two numbers such that they add up to a specific target number.
  8. Given a linked list, determine if it has a cycle in it.
  9. Given a binary tree, find its maximum depth.
  10. Given a string, find the first non-repeating character in it.
  11. Given an array of integers, find the contiguous subarray with the largest sum and return its sum.
  12. Implement a function to check if a binary tree is balanced. A balanced binary tree is defined as a tree such that the heights of the two subtrees of any node never differ by more than one.
  13. Given an array of integers, write a function to find the maximum product of three numbers in the array.
  14. Write a function to find the longest increasing sub-sequence in an array of integers.
  15. Write a function to find the first missing positive integer in an unsorted array of integers.
  16. Write a function to reverse a linked list.
  17. Write a function to check if a given binary tree is balanced.
  18. Write a function to reverse a linked list.
  19. Implement a stack that supports the following operations: push, pop, top, and retrieving the minimum element in constant time.
  20. Given a matrix of integers, find the length of the longest increasing path. A path is defined as a sequence of adjacent integers that are either vertically or horizontally connected. The matrix can only be traversed in the four cardinal directions (up, down, left, or right).
  21. Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
Tip: State your approach, complexity, and edge cases (empty input, duplicates, large data, Unicode). If time remains, discuss alternative strategies.