269. Alien Dictionary

There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you. You are given a list of strings words from the alien language’s dictionary, where the strings in words are sorted lexicographically by the rules of this new language. Return a string of the unique letters in the new alien language sorted in lexicographically increasing order by the new language’s rules....

<span title='2022-01-29 00:00:00 +0000 UTC'>January 29, 2022</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

752. Open the Lock

You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’. The wheels can rotate freely and wrap around: for example we can turn ‘9’ to be ‘0’, or ‘0’ to be ‘9’. Each move consists of turning one wheel one slot. The lock initially starts at ‘0000’, a string representing the state of the 4 wheels....

<span title='2022-01-29 00:00:00 +0000 UTC'>January 29, 2022</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

671. Second Minimum Node In a Binary Treer

Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node’s value is the smaller value among its two sub-nodes. More formally, the property root.val = min(root.left.val, root.right.val) always holds. Given such a binary tree, you need to output the second minimum value in the set made of all the nodes’ value in the whole tree....

<span title='2022-01-13 00:00:00 +0000 UTC'>January 13, 2022</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1136. Parallel Courses

You are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given an array relations where relations[i] = [prevCoursei, nextCoursei], representing a prerequisite relationship between course prevCoursei and course nextCoursei: course prevCoursei has to be taken before course nextCoursei. In one semester, you can take any number of courses as long as you have taken all the prerequisites in the previous semester for the courses you are taking....

<span title='2021-11-30 00:00:00 +0000 UTC'>November 30, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

286. Walls and Gates

You are given an m x n grid rooms initialized with these three possible values. -1 A wall or an obstacle. 0 A gate. INF Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF as you may assume that the distance to a gate is less than 2147483647. Fill each empty room with the distance to its nearest gate. If it is impossible to reach a gate, it should be filled with INF....

<span title='2021-11-27 00:00:00 +0000 UTC'>November 27, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

126. Word Ladder II

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> … -> sk such that: Every adjacent pair of words differs by a single letter. Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList. sk == endWord Given two words, beginWord and endWord, and a dictionary wordList, return all the shortest transformation sequences from beginWord to endWord, or an empty list if no such sequence exists....

<span title='2021-11-25 00:00:00 +0000 UTC'>November 25, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

815. Bus Routes

You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> … forever. You will start at the bus stop source (You are not on any bus initially), and you want to go to the bus stop target....

<span title='2021-11-24 00:00:00 +0000 UTC'>November 24, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

261. Graph Valid Tree

Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h. 1 2 3 4 5 Example 1: Input: root = [1,2,3,4,5,6] Output: true Explanation: Every level before the last is full (ie....

<span title='2021-10-12 00:00:00 +0000 UTC'>October 12, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

297. Serialize and Deserialize Binary Tree

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure....

<span title='2021-09-19 00:00:00 +0000 UTC'>September 19, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;volyx

515. Find Largest Value in Each Tree Row

515. Find Largest Value in Each Tree Row Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Example 1: Input: root = [1,3,2,5,3,null,9] Output: [1,3,9] Example 2: Input: root = [1,2,3] Output: [1,3] Example 3: Input: root = [1] Output: [1] Example 4: Input: root = [1,null,2] Output: [1,2] Example 5: Input: root = [] Output: [] Constraints:...

<span title='2021-07-19 00:00:00 +0000 UTC'>July 19, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

1302. Deepest Leaves Sum

1302. Deepest Leaves Sum Given the root of a binary tree, return the sum of values of its deepest leaves. 1 2 3 4 Example 1: Input: root = [1,2,3,4,5,null,6,7,null,null,null,null,8] Output: 15 1 2 3 4 Example 2: Input: root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5] Output: 19 Constraints: The number of nodes in the tree is in the range [1, 104]. 1 <= Node.val <= 100 Solution 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 /** * Definition for a binary tree node....

<span title='2021-03-31 00:00:00 +0000 UTC'>March 31, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

773. Sliding Puzzle

![https://leetcode.com/problems/sliding-puzzle/] On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it. The state of the board is solved if and only if the board is [[1,2,3],[4,5,0]]. Given a puzzle board, return the least number of moves required so that the state of the board is solved....

<span title='2021-02-07 00:00:00 +0000 UTC'>February 7, 2021</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;volyx