All Posts

Leetcode 894: All Possible Full Binary Trees

Given an integer n, return all possible full binary trees with exactly n nodes. Each node of the tree must have the value 0. A full binary tree is defined as a binary tree where each node has either 0 or 2 children.

Leetcode 1137: N-th Tribonacci Number

The Tribonacci sequence is defined by the following recurrence relation: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given an integer n, return the value of Tn.

Leetcode 1387: Sort Integers by The Power Value

The task is to find the kth integer in the range [lo, hi] sorted by the number of steps required to reach 1 using the Collatz conjecture rules. The power of a number is the number of steps needed to reach 1, following the rules: if the number is even, divide it by 2, and if it’s odd, multiply it by 3 and add 1.

Leetcode 2311: Longest Binary Subsequence Less Than or Equal to K

You are given a binary string s and a positive integer k. Your task is to find the length of the longest subsequence of s that represents a binary number less than or equal to k when converted to decimal.