Syed Ali Hassan's repositories
TimePlanner-EarliestCommonTimeSlot
Implement a function meetingPlanner that given the availability, slotsA and slotsB, of two people and a meeting duration dur, returns the earliest time slot that works for both of them and is of duration dur.
K-Messed-Array-Sort
Given an array of integers arr where each element is at most k places away from its sorted position, code an efficient function sortKMessedArray that sorts arr.
MinStepsToCoverGrid
You are in an infinite 2D grid where you can move in any of the 8 directions:
Letter-Combinations-Of-Phone-Number
Given a digit string, return all possible letter combinations that the number could represent.
PermutationsOfIntegerArray
Given a collection of distinct integers, return all possible permutations.
CombinationSumNonRepeating
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
CombinationSum
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Generate-Parantheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Equals-A-plus-B-equals-C-plus-D-
Given an array A of integers, find the index of values that satisfy A + B = C + D, where A,B,C & D are integers values in the array
SubStringConcatenation
You are given a string, S, and a list of words, L, that are all of the same length.
ReverseLinkedListBetweenTwoNodes
Reverse a linked list from position m to n.
SortByColor
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent
IntersectionOfSortedArrays
Find the intersection of two sorted arrays.
FindPair-DifferenceIsEqualToTarget
Given a sorted array and a number n, find if there exists a pair of elements in the array whose difference is n.
CountAndSay
The count-and-say sequence is the sequence of integers beginning as follows:
RomanToInteger
Given a roman numeral, convert it to an integer.
IntegerToRoman
Given an integer, convert it to a roman numeral, and return a string corresponding to its roman numeral version
SqureRoot-UsingBinarySearch
Calculate Square root of integer using binary search
RearrangeArray
Arr[Arr[i]], Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space
YearWhenMaxPeopleWereAlive-MaxIntervalOverlapProblem
Find the year when maximum number of people we alive.
AllPathsFromRootToLeafInBinaryTree
Given a binary tree, return all paths from the root to leaves.
LargestRegionInBooleanMatrix-DFS
Find length of the largest region in Boolean Matrix
IslandFinder-DFS
Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island.
FindPairWithGivenSumInTree
Given the root of a binary search tree, and a target K, return two nodes in the tree whose sum equals K.
Tree1-Contains-Tree2
Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s.
Delete-K-Chars-Palindrome
Given a string which we can delete at most k, return whether you can make a palindrome
LongestWordInDictionary
Find longest word from dictionary that has all characters from key.
CakeThief-0-1-Knapsack
The problem is solved using dynamic programming using 0-1 Knapsack approach.