All Posts

Leetcode 784: Letter Case Permutation

Given a string s, you can transform every letter individually to either lowercase or uppercase. Digits remain unchanged. Your task is to generate a list of all possible strings that can be created by changing the case of the letters in the string.

Leetcode 797: All Paths From Source to Target

You are given a directed acyclic graph (DAG) with n nodes, labeled from 0 to n-1. Find all possible paths from node 0 to node n-1 and return these paths in any order. The graph is represented such that each node has a list of other nodes that can be visited directly from it.

Leetcode 816: Ambiguous Coordinates

You are given a string s representing coordinates that have been encoded by removing commas, decimal points, and spaces. Your task is to restore the coordinates to their original form by considering all possible valid ways the digits could be split into two parts: a left part representing the x-coordinate and a right part representing the y-coordinate. Both parts may optionally contain a decimal point. The final coordinates must follow specific rules: no leading zeros are allowed, and the decimal point must be placed correctly. Return a list of all possible valid coordinates, formatted as ‘(x, y)’, where x and y represent the respective coordinates.

Leetcode 842: Split Array into Fibonacci Sequence

You are given a string of digits, and you need to split it into a sequence of integers that follow the Fibonacci-like property. In other words, the sum of the first two numbers should equal the third, the sum of the second and third should equal the fourth, and so on. Your goal is to find any valid Fibonacci-like sequence from the digits, or return an empty list if it’s not possible.

Leetcode 967: Numbers With Same Consecutive Differences

Generate all numbers of length n such that the absolute difference between every two consecutive digits is exactly k. The generated numbers must not have leading zeros, and all digits should be valid.

Leetcode 988: Smallest String Starting From Leaf

You are given the root of a binary tree, where each node contains a value between 0 and 25, corresponding to letters from ‘a’ to ‘z’. Your task is to find the lexicographically smallest string that can be formed by traversing from a leaf node to the root node, using the values in each node as letters.