Git Product home page Git Product logo

problems's Introduction

Contents are moved to Data Structure and Algorithms repo

Pls this that repo instead of this.

At least one problem a day, keeps your lazy brain away (Mostly weekdays) :P

Day Total Problems
80 92

Table of Contents

Array

Date Problems Solutions
Jan 05 2018 Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space (auxiliary space). Rearrange Array
Jan 06 2018 Given a list of non negative integers, arrange them such that they form the largest number. Largest Formed Number
Jan 19 2018 Flatten the given array. Flatten Multiple Level Array
Jan 24 2018 Wave the given array. Wave Array
Feb 21 2018 Given an array and a value, remove all instances of that value in-place and return the new length. Remove Element
Mar 08 2018 Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal". Find Relative Winners
Mar 12 2018 In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. Reshape To Matrix
Mar 25 2018 Given an array of integers of size โ€˜nโ€™. Calculate the maximum sum of โ€˜kโ€™ consecutive elements in the array. Max Sum Of K Elements
Mar 28 2018 Given an array of integers, every element appears twice except for one. Find that single one. Find Single Number
Mar 28 2018 Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is 0.) Area of Island (2D Array)
Mar 29 2018 Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Find the Missing Number
Apr 03 2018 Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these candies equally in number to brother and sister. Return the maximum number of kinds of candies the sister could gain. Distribute Candies
Apr 05 2018 Given a binary array, find the maximum number of consecutive 1s in this array. Max Consecutives Ones
Mar 14 2019 Return the lowest index at which a value (second argument) i.e num should be inserted into an array (first argument). Where do i belong
Mar 14 2019 Find the container With most water. Water Container
Mar 15 2019 Reverse Words in a String. Reverse Words in a String
Mar 26 2019 Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die. Can Place Flowers
Apr 15 2019 Given an array, rotate the array to the right by k steps, where k is non-negative. Rotate Array
May 21 2019 Given two arrays, write a function to compute their intersection. Intersection of Two Arrays
Jun 25 2019 Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. Sort Array By Parity
Sep 10 2019 Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Find Duplicate Numbers
Sep 23 2019 Given a set of distinct integers, nums, return all possible subsets (the power set). Subsets
Oct 03 2019 Given a lowercase string that has a-z chars only and no spaces, return the length of the longest vowel substring. Longest Vowel Chain
Jan 13 2020 Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Keyboard Row

Bit Manipulation

Date Problems Solutions
Jan 11 2018 Given a sorted array of integers, find the number of occurrences of a given target value (complexity should be O(number of ones). Number of 1 BitsBookmark
Jan 11 2018 Given a sorted array of integers, find the number of occurrences of a given target value (complexity should be O(number of ones). Sum Of Two Numbers

BackTracking

Date Problems Solutions
Mar 16 2019 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. Word Search in 2D
Apr 08 2019 Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. [Surrounded Area in 2D](BackTracking/2. surrounded_area.js)

Cache

Date Problems Solutions
Mar 13 2019 Implement LRU cache. Implement LRU cache

Hashing

Date Problems Solutions
Jan 29 2018 Given an array of strings, return all groups of strings that are anagrams. Array of Anagrams
Apr 09 2018 International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.. Unique Morse Codes
Mar 16 2019 Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Set Matrix Zeros
Mar 27 2019 Given an array of integers, return indices of the two numbers such that they add up to a specific target. Two Sum

In Place

Date Problems Solutions
Dec 2 2018 Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent. Sort Colours

Linked List

Date Problems Solutions
Jan 22 2018 Reverse a linked list. Do it in-place and in one-pass. Reverse A Linked List
Feb 12 2018 Merge two sorted linked lists and return it as a new list. Merge Two Sorted Linked Lists Without Duplicates
Feb 21 2018 Merge two sorted linked lists and return it as a new list. Merge Two Sorted Linked Lists With Duplicates
Feb 28 2018 Given a linked list, determine if it has a cycle in it. Find if linked list is circular or not
Mar 07 2018 Write a program to find the node at which the intersection of two singly linked lists begins. Intersection of two linked list
Mar 15 2018 Sort a linked list in O(n log n) time using constant space complexity. Sort Linked List
Mar 22 2018 Remove all elements from a linked list of integers that have value val. Remove elements in Linked List
Nov 19 2018 Given a sorted linked list, delete all duplicates such that each element appear only once. Remove duplicates in Linked List
Mar 24 2018 iven a binary tree, flatten it to a linked list in-place. Binary Tree to Linked List

Math

Date Problems Solutions
Aug 29 2019 Find the original price of a product before sales discount. Find original price

Numbers

Date Problems Solutions
Feb 26 2018 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. Plus One
Mar 04 2018 Given a positive integer n and you can do operations as follow, n/2 if even and n - 1 or n + 1 if odd Integer Replacement
Nov 13 2018 Given an array of size n, find the majority element. The majority element is the element that appears more than โŒŠ n/2 โŒ‹ times. Majority Elements
Nov 28 2018 Given an integer, write a function to determine if it is a power of three. Power of 3
Feb 20 2019 Count the number of prime numbers less than a non-negative number, n. Count Primes
Feb 25 2019 Implement atoi which converts a string to an integer. String To Number
Mar 19 2019 Write an algorithm to determine if a number is "happy". Happy Number
Mar 28 2019 Find All Numbers Disappeared in an Array. Find Disappeared in an Array
Sep 09 2019 A self-dividing number is a number that is divisible by every digit it contains. Self Dividing Numbers

Recursion

Date Problems Solutions
Sep 30 2019 Find number of ways a frog can jump (1 feet jump or 2 feet jump) to make it across the river. Frog Jump
Date Problems Solutions
Jan 08 2018 Given a sorted array of integers, find the number of occurrences of a given target value (complexity should be O(log n). Count Element Occurence
Aug 21 2018 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. Search Insert Position
Aug 29 2018 Given an integer n, return the number of trailing zeroes in n!. Trailing Factorial Zeros

Stack and Queues

Date Problems Solutions
Mar 22 2018 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Evaluate Reverse Polish Notation
Nov 12 2018 Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Design a stack
Nov 17 2018 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Is Valid Parentheses
Mar 11 2019 Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. Daily Temperatures
Mar 21 2019 Given a string "S" representing the initial state. S[i] = 'L', if the i-th domino has been pushed to the left; S[i] = 'R', if the i-th domino has been pushed to the right; S[i] = '.', if the i-th domino has not been pushed. Return a string representing the final stat Push Dominoes

Strings

Date Problems Solutions
Jan 09 2018 Write a function to find the longest common prefix string amongst an array of strings. Longest Common Prefix
Jan 10 2018 Find if Given number is power of 2 or not (number can be greater than 2 ^ 64). Power of 2
Feb 20 2018 Given a positive integer, return its corresponding column title as appear in an Excel sheet. Excel Sheet Column Title
Feb 22 2018 Given an array of strings, group anagrams together. Group Of Anagrams
Feb 26 2018 Convert a non-negative integer to its english words representation. Number To Words
Mar 21 2018 You are given a string representing an attendance record for a student. The record only contains the following three characters: Students Attendance
Mar 26 2018 Given a string, that contains special character together with alphabets (โ€˜aโ€™ to โ€˜zโ€™ and โ€˜Aโ€™ to โ€˜Zโ€™), reverse the string in a way that special characters are not affected. String Reversal With Special Characters
Aug 23 2018 Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. Length Of Last Words
Oct 30 2018 Given a string, find the length of the longest substring without repeating characters. Find Longest SubString
Nov 15 2018 Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. First Unique Character
Nov 28 2018 Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Implement strStr()
Mar 24 2019 Check whether two Strings are Anagram of each other. Check Anagram

Trees

Date Problems Solutions
Feb 05 2018 Given a binary tree, find its maximum depth. Max Depth Of Tree
Feb 08 2018 Given a binary tree, find its minimum depth. Min Depth Of Tree
Feb 27 2018 Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. Find Second Minimum Node
Mar 07 2018 Given a binary tree, determine if it is height-balanced. Balanced Tree
Mar 22 2018 Check if given binary tree is BST or not. Check Tree is BST
Mar 23 2018 Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. Lowest Common Ancestor Of BST
Mar 23 2018 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the BT. Lowest Common Ancestor Of BT
Mar 25 2018 Given two binary trees, write a function to check if they are the same or not. Same Tree Or Not
Mar 25 2018 Given a binary trees, invert it. Invert Binary Tree
Mar 26 2018 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). Symmetric Tree
Aug 27 2018 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Has Path Sum
Mar 12 2019 Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Level Order Traversal

Two Pointers

Date Problems Solutions
Jan 18 2018 Given 2 sorted arrays, find all the elements which occur in both the arrays. Intersection Of Sorted Arrays
Jan 30 2018 Given a sorted array, remove the duplicates in place such that each element can appear atmost twice and return the new length. Remove Duplicates From Sorted Array
Feb 27 2018 Given 2 arrays, find all the elements which occur in both the arrays without sorting. Intersection Of Unsorted Arrays
Mar 19 2019 Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Shortest Distance to a Character

Trie

Date Problems Solutions
Mar 12 2019 Implement a trie with insert, search, and startsWith methods. Implement Trie

problems's People

Contributors

gokulkrishh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.