This course is available as part of the raywenderlich.com Professional subscription. To learn more click here

Kotlin Whiteboard

Pro

Jul 28 2020 · Video Course (3 hrs, 5 mins) · Intermediate

Level up your whiteboard interview skills by solving a number of common coding interview questions using Kotlin.

4.3/5 6 Ratings

Version

  • Kotlin 1.3, IntelliJ IDEA 2020.1

Introduction

Learn about the common developer interview practice of whiteboarding, and see some strategies for preparing for whiteboard interviews.

1

Understand the prerequisites for following along with the course, and see some resources for learning about data structures and algorithms.

2

See how to create IntelliJ IDEA Kotlin JVM projects that allow you to work with the sample code from the course episodes and how to use the Kotlin playground.

3

Learn about binary search and solve a warm-up question that uses a technique similar to binary search.

4

Linear Data Structures

See a review of some of the key properties of linear data structures: arrays, linked lists, stacks, and queues.

5

Given a linked list, create an extension function on the LinkedList class to print the nodes in reverse order.

6

Given a linked list, find the middle node in the list.

7

Given a linked list, reverse the linked list itself, so that the nodes are linked in the opposite direction.

8

Create a function that takes two sorted linked lists and merges them into a single sorted linked list.

9

Given a linked list, create an extension function on the LinkedList class to print the nodes in reverse order, but this time, with no recursion.

10

Given a string, check whether the string has matching parentheses.

11

Imagine you’re playing a game of Monopoly with your friends. Create a Monopoly organizer that tells you whose turn it is.

12

Implement a method to reverse the contents of a queue using an extension function.

13

Trees

Trees

4:04

Review the definitions surrounding tree data structures and the properties of a number of tree variants.

14

Print the values in a tree in an order based on their level.

15

Given a Binary Tree, write an extension function to find the height of the tree.

16

Devise a way to serialize a Binary Tree into a list, and a way to deserialize the list back into the same Binary Tree.

17

Create a function that checks if a Binary Tree is a Binary Search Tree.

18

Add methods to a BinarySearchTree class and BinaryNode class to check whether two BSTs are equal.

19

Create a method to checks if one BST contains all of the elements of another BST.

20

How many leaf nodes are there in a perfectly balanced Binary Tree of height 3? What about a perfectly balanced Binary Tree of height h?

21

How many nodes are there in a perfectly balanced Binary Tree of height 3? What about a perfectly balanced Binary Tree of height h?

22

Heaps and Priority Queues

Review the heap and priority queue data structures as well as their properties and applications.

23

Write a function to find the nth smallest integer in an unsorted array.

24

Instead of a heap, use an ArrayList to implement a Priority Queue.

25

Use a priority queue to get a list of people on a waitlist by the appropriate priority.

26

Basic Sorting

See an animated review of the basic sorting algorithms.

27

Review Bubble Sort visually then add Bubble Sort as an extension function on MutableList.

28

Review Selection Sort visually then add Selection Sort as an extension function on MutableList.

29

Review Insertion Sort visually then add Insertion Sort as an extension function on MutableList.

30

Given a list of Comparable elements, bring all instances of a given value in the list to the right side of the list.

31

Given a list of Comparable elements, return the largest element that’s a duplicate in the list.

32

Create a function to reverse a mutable list of elements without relying on any library functions.

33

Advanced Sorting

Review some of the more advanced sorting algorithms: Merge Sort, Radix Sort, Heap Sort, and Quicksort.

34

Write a function that takes two sorted Kotlin iterables and merges them into a single iterable.

35

Implement a most-significant-digit (MSD) Radix Sort, also called lexicographical sorting.

36

When performing a Heap Sort in ascending order, choose which of two starting arrays require the fewest comparisons.

37

Use Heap Sort to sort an array in descending order instead of ascending order.

38

The Quicksort algorithm is typically implemented using recursion. Can you implement it iteratively?

39

Graphs

Graphs

2:41

Review the definition of graphs as well as some of the properties of graphs and their implementation.

40

Write a method to count the number of paths between two vertices in a directed graph.

41

Determine the maximum number of items ever in the queue used to perform a breadth-first traversal on a given undirected graph.

42

Implement a graph breadth-first traversal using recursion and not iteration.

43

Create a graph method to detect whether or not a graph is disconnected.

44

DFS or BFS

0:50

For a given graph, determine which traversal (DFS or BFS) is better for discovering if a path exists between certain nodes.

45

Create a graph method to detect if a directed graph has a cycle.

46

Who is this for?

Kotlin developers preparing for job interviews or looking to refresh their coding interview skills.

Covered concepts

  • Binary search
  • Linear data structures: linked lists, stacks, and queues
  • Trees, Binary Trees, BSTs, and AVL Trees
  • Heaps and Priority Queues
  • Basic sorting algorithms
  • Merge Sort, Radix Sort, Heap Sort, and Quicksort
  • Graphs, BFS, and DFS

Contributors

Comments