Writing
-
Leetcode: Remove element from list
Continue readingGiven the
headof a linked list, remove all items withval. Afterwards, return the new head. -
Leetcode: Remove element
Continue readingGiven an array
nums, delete all items that are equal toval. Return the total number of remaining items and perform the deletion in place. -
Leetcode: Binary tree zigzag level order traversal
Continue readingTraverse a tree where the
rootnode is given with a zig-zag level and return the values in alistwith one entry per level. For example:--> 3 / \ 9 5 <-- / \ --> 7 8 Returns: [[3], [5,9], [7,8]] -
Leetcode: Binary tree level order traversal
Continue readingGiven the
rootnode of a binary tree, print all values in order, meaning from left to right on the same level.To solve this, we can use the standard breadth-first-search (BFS) algorithm in an iterative fashion with a
queue. As an output we use alistand leverage the position-1to add the current level to the list. For every level we append one new element to the end of the list. -
Leetcode: Valid sudoku
Continue readingGiven a Sudoku field as a two-dimension list, determine if the field is valid. A valid field only has the number 1-9 once in each sub-field, each row, and each column. The field is not completely filled and we don’t need to check for a valid solution.