Additional Programming Questions
Additional Programming Questions
- If n is divisible by 3, divide it by 3.
- If n is divisible by 2, divide it by 2.
- Subtract 1 from n.
Example:
Input: n = 10
You are given two integers m and n, representing the dimensions of an m x n grid. You start at the
top-left corner and can only move down or right at any point in time. Find the number of unique
Example:
Input: m = 3, n = 7
Output: 28
Given an array representing the heights of bars in a histogram where the width of each bar is 1, find
the area of the largest rectangle that can be formed in the histogram.
Example:
Example:
Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine if the input string is
valid.
Example:
Input: s = '([{}])'
Output: true
Input: s = '(]'
Output: false
Given an array of integers height where each element represents the height of a vertical line on the
x-axis. Find two lines, which together with the x-axis forms a container, such that the container
Example:
Given the root of a binary tree, return the level order traversal of its nodes' values (i.e., from left to
right, level by level).
Example:
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals and
return an array of the non-overlapping intervals that cover all the intervals in the input.
Example:
Output: [[1,6],[8,10],[15,18]]
Given two strings s and p, return an array of all the start indices of p's anagrams in s.
Example:
Output: [0,6]
Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the
Example:
Output: 13