All Posts

Leetcode 779: K-th Symbol in Grammar

We build a sequence of rows starting with the string ‘0’ in the first row. For each subsequent row, every occurrence of ‘0’ from the previous row is replaced with ‘01’, and every occurrence of ‘1’ is replaced with ‘10’. Given two integers n and k, return the k-th (1-indexed) symbol in the n-th row.

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 1545: Find Kth Bit in Nth Binary String

Given two positive integers n and k, the binary string Sn is formed recursively. The task is to return the kth bit in the string Sn.

Leetcode 1823: Find the Winner of the Circular Game

In this problem, there are n friends sitting in a circle. The game proceeds by counting k friends clockwise starting from the 1st friend. The last friend counted leaves the circle. This continues until only one friend remains, who is the winner. Your task is to find the winner of the game given n and k.

Leetcode 1969: Minimum Non-Zero Product of the Array Elements

You are given a positive integer p. Consider an array nums (1-indexed) that consists of the integers in the inclusive range [1, 2p - 1] represented in binary form. You are allowed to perform the following operation any number of times: Choose two elements x and y from nums. Choose a bit in x and swap it with its corresponding bit in y. The goal is to find the minimum non-zero product of the elements in nums after performing the above operation any number of times. Return this minimum product modulo (10^9 + 7).

Leetcode 2487: Remove Nodes From Linked List

You are given the head of a linked list. Your task is to remove every node that has a node with a greater value to its right. The modified linked list should be returned after the removal of such nodes.