Ques Bank Updated
Ques Bank Updated
Ques Bank Updated
1. Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero
2. Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's.
3. Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j
< k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false
4. Given a string s, return the longest palindromic substring in s
5. Given a string s, find the length of the longest substring without repeating characters
6. Given an array of strings strs, group the anagrams together. You can return the answer
in any order.
Backtracking
1. Given an m x n grid of characters board and a string word, return true if word exists in the
grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent
cells are horizontally or vertically neighboring. The same letter cell may not be used more
than once
2. Given an integer array nums of unique elements, return all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
3. Given an array nums of distinct integers, return all the possible permutations. You can return
the answer in any order.
4. Given a string containing digits from 2-9 inclusive, return all possible letter combinations
that the number could represent. Return the answer in any order. A mapping of digits to
letters is just like on the telephone buttons
Dynamic Programming
1. Given an array nums with n objects colored red, white, or blue, sort them in-place so that
objects of the same color are adjacent, with the colors in the order red, white, and blue
2. 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.
Others
1. Given a characters array tasks, representing the tasks a CPU needs to do, where each letter
represents a different task. Tasks could be done in any order. Each task is done in one unit of
time. For each unit of time, the CPU could complete either one task or just be idle. However,
there is a non-negative integer n that represents the cooldown period between two same
tasks (the same letter in the array), that is that there must be at least n units of time
between any two same tasks. Return the least number of units of times that the CPU will
take to finish all the given tasks.