Skip to content

EthanPui/Code-Challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Challenges

Coding Challenges for Interview prep

Data Structures

https://www.freecodecamp.org/news/the-top-data-structures-you-should-know-for-your-next-coding-interview-36af0831f5e3/

Arrays

Basic Operations on Arrays Insert — Inserts an element at a given index Get — Returns the element at a given index Delete — Deletes an element at a given index Size — Gets the total number of elements in an array

Commonly asked Array interview questions

  • Find the second minimum element of an array
  • First non-repeating integers in an array
  • Merge two sorted arrays
  • Rearrange positive and negative values in an array

Stacks (LIFO)

Basic operations of stack:

Push — Inserts an element at the top Pop — Returns the top element after removing from the stack isEmpty — Returns true if the stack is empty Top — Returns the top element without removing from the stack

Commonly asked Stack interview questions

  • Evaluate postfix expression using a stack
  • Sort values in a stack
  • Check balanced parentheses in an expression

Queues (FIFO)

Basic operations of Queue Enqueue() — Inserts an element to the end of the queue Dequeue() — Removes an element from the start of the queue isEmpty() — Returns true if the queue is empty Top() — Returns the first element of the queue

Commonly asked Queue interview questions

  • Implement stack using a queue
  • Reverse first k elements of a queue
  • Generate binary numbers from 1 to n using a queue

Linked List

Basic operations of Linked List: InsertAtEnd — Inserts a given element at the end of the linked list InsertAtHead — Inserts a given element at the start/head of the linked list Delete — Deletes a given element from the linked list DeleteAtHead — Deletes the first element of the linked list Search — Returns the given element from a linked list isEmpty — Returns true if the linked list is empty

Commonly asked Linked List interview questions

  • Reverse a linked list
  • Detect loop in a linked list
  • Return Nth node from the end in a linked list
  • Remove duplicates from a linked list

Graphs

Types of Graphs:

Undirected Graph Directed Graph

In a programming language, graphs can be represented using two forms: Adjacency Matrix Adjacency List

Common graph traversing algorithms: Breadth First Search Depth First Search

Commonly asked Graph interview questions

  • Implement Breadth and Depth First Search
  • Check if a graph is a tree or not
  • Count the number of edges in a graph
  • Find the shortest path between two vertices

Trees

The following are the types of trees:

N-ary Tree Balanced Tree Binary Tree Binary Search Tree AVL Tree Red Black Tree 2–3 Tree Out of the above, Binary Tree and Binary Search Tree are the most commonly used trees.

Commonly asked Tree interview questions

  • Find the height of a binary tree
  • Find kth maximum value in a binary search tree
  • Find nodes at “k” distance from the root
  • Find ancestors of a given node in a binary tree

Hash Table

Hash tables are generally implemented using arrays.

Commonly asked Hashing interview questions Find symmetric pairs in an array Trace complete path of a journey Find if an array is a subset of another array Check if given arrays are disjoint

About

📚💻 Coding Challenges for Interview prep

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors