Skip to content

davidsbatista/coding-exercises

Repository files navigation

programming-exercises

A repository of coding interview questions and their solutions. This repository contains different technical questions that show up at coding interviews and the solutions for some of them in python.

Resources:

reddit.com cscareerquestions

Complexities

Complexities PDF

Design Patterns

Factory Method

Singleton

Graphs

Dijkstra Shortest Path

Heap, Stack, Queues

Find the minimum element in a stack in O(1) time

Implement a circular queue using array

Arrays

Find the most frequent integer

For a given array count combination of pairs of (x,y) whose sum is N

Given a sorted array with duplicates and a number, find the range in the form of (startIndex, endIndex) of that number

Find the contiguous sub-array in an array which has the largest sum

Rotate an array by N elements

Lists

Singly Linked List Implementation

Given a nested list of integers, return the sum of all integers in the list weighted by their depth

Reverse a linked list iteratively and recursively

Merge two sorted linked list

How to find the 3rd element from end, in a singly linked, in a single pass?

Find the Nth element in a linked list

Remove the Nth element of a linked list

Check if a linked list has cycles

Given a circular linked list, find the node at the beginning of the loop. Example: A-->B-->C-->D-->E-->C, C is the node that begins the loop

Writer an iterator for a linked list which may include nodes which are nested within other nodes. Example, given the list: (1)->(2)->(3(4))->((5)(6), the iterator returns 1->2->3->4->5->6

Implement the addition of two numbers, where each one of them is represented as digits of a linked list. The result should also be written in the form of digits of a linked list.

Miscellaneous

Recursion, Dynamic Programming, Memoization

Fibonnaci Sequence

Sets

Compute the intersection of two sets

Sorting

Buuble Sort

Select Sort

Insertion Sort

Merge Sort

Quick Sort

Counting Sort

Radix Sort

Bucket Sort

Heap Sort

Bogo Sort

Quantum Sort

Strings

Given two strings, determine if they are isomorphic

Compress a string

Find out whether an array/string contains non-repeated characters

Generate a list of all permutation of a string

Given sequence of characters determine if it is a palindrome

Given a string, determine the length of the longest substring which does not have duplicated characters

Reverse a string

Uppercase all the words in string which have length of N

Given a source word, target word and a dictionary, transform the source word to target by changing/adding/removing 1 character at a time, while all intermediate words being valid words. Return the transformation chain which has the smallest number of intermediate words.

Segment a long string into a set of valid words using a dictionary

Write a function to remove duplicate characters from string

Knuth–Morris–Pratt algorithm

Trees

Binary Search Tree Implementation

Given a tree string expression in balanced parenthesis print the three by levels

Releases

No releases published

Packages

No packages published

Languages