For each given problem, there is a solution. In this project you can find solutions for some typical problems given in interviews.
To download and use this repo, copy and paste next bash commant into command line
$ git clone https://github.com/kakarot94/ProblemAndSolution.git
- Dinamic array [look me up]
- Insertion sort [look me up]
- Selection sort [look me up]
- Bubble sort [look me up]
- Recursive bubble sort [look me up]
- Quick sort [look me up]
- Marge sort [look me up]
- Marge sort II [look me up]
- Heap sort [look me up]
- Heap sort II [look me up]
- Heap sort generic [look me up]
- Counting sort simple [look me up]
- Counting sort char [look me up]
- Binary search [look me up]
- Recursive binary search [look me up]
- Jump search [look me up]
- Recursive jump search [look me up]
- Add strings [look me up]
- Two numbers are given in the form of String. Add those two numbers without transforming String into integer.
- Add to array [look me up]
- Given the array of length n and random number, add those two values.
Examle :
Array value = {5, 3, 2}
int value = 2 5 6
result value = {7, 8, 8}
- Given the array of length n and random number, add those two values.
- Add two single linked lists [look me up]
- You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
- Atoi integer converter [look me up]
- Implement atoi which converts a string to an integer.
- Addition of submatrix [look me up]
- Given a matrix C of size N x M. You are given position of submatrix as X1, Y1 and X2, Y2 inside the matrix. Find the sum of all elements inside that submatrix.
- Busiest server [look me up]
- You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite
computational capacity but cannot handle more than one request at a time. The requests are assigned to servers according to a specific algorithm:
- The ith (0-indexed) request arrives.
- If all servers are busy, the request is dropped (not handled at all).
- If the (i % k)th server is available, assign the request to that server.
- Otherwise, assign the request to the next available server.
- You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite
computational capacity but cannot handle more than one request at a time. The requests are assigned to servers according to a specific algorithm:
- Container with most water [look me up]
- Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two end points of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
- Devide number [look me up]
- Given the number n, devide that number without using devidor.
- Decode ways [look me up]
- Something about decoding xD
- Devide two numbers [look me up]
- Given the two numbers, devide them without using devidor.
- Encryption [look me up]
- Do some encryption work xD
- Find the fine [look me up]
- Given an array of penalties P, an array of car numbers C, and also the date D. The task is to find the total fine which will be collected on the given date. Fine is collected from odd-numbered cars on even dates and vice versa.
- Hammering nails [look me up]
- Depending on the arrangement of a given sequence of numbers and a given number of possible shifts, determine the length of the longest substring that can be obtained with certain shifts.
- Integer extractor [look me up]
- Given a string containing none, one or many numbers, find all numbers in that string. Numbers is non-negative and can be divided by any character.
- Is given String palindrom [look me up]
- Check if the String is palindrom.
- Increment array [look me up]
- Given the array that represents number, increment that array by one.
- Kth smallest element [look me up]
- Given an array arr[] and a number K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.
- Longest palindrom [look me up]
- Given a String s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
- Marging lists [look me up]
- Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists.
- Madian of two sorted arrays [look me up]
- Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
- Marging K lists [look me up]
- You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.
- Multiply strigs [look me up]
- Given two string representations of numbers, multiply them without converting them into int.
- Palindrome number [look me up]
- Given a integer n, find if that integer is palindrome without converting that integer into string.
- Palindrom linked list [look me up]
- Check whether given linked list is palindrome.
- Parking system design [look me up]
- Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
- Qeens atack II [look me up]
- You will be given a square chess board with one queen and a number of obstacles placed on it. Determine how many squares the queen can attack.
- Reverse integer [look me up]
- Given a 32-bit signed integer, reverse digits of an integer.
- Reverse K nodes in linked list [look me up]
- Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
- Shortest unsorted continuous array [look me up]
- Given the array of numbers, find shortest unsorted continuous array. Remember, one element is sorted, that means result can eather be 0 or greater then 1.
- Subarray product less then K [look me up]
- Given the array of integers and one K number, find subarray where product of that array is less then K.
- Special position [look me up]
- Given the two dimensional array, find special position in that array.
- The 3 sum [look me up]
- 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.
- Two sum [look me up]
- Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
- Two sum ordered [look me up]
- Given an array of ordered integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
- Valid parentheses [look me up]
- Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.