[LeetCode] Split Linked List in Parts

725. Split Linked List in Parts

Given the head of a singly linked list and an integer k, split the linked list into k consecutive linked list parts.

The length of each part should be as equal as possible: no two parts should have a size differing by more than one. This may lead to some parts being null.

The parts should be in the order of occurrence in the input list, and parts occurring earlier should always have a size greater than or equal to parts occurring later.

Return an array of the k parts.

Read more
[LeetCode] Rabbits in Forest

781. Rabbits in Forest

There is a forest with an unknown number of rabbits. We asked n rabbits “How many rabbits have the same color as you?” and collected the answers in an integer array answers where answers[i] is the answer of the ith rabbit.

Given the array answers, return the minimum number of rabbits that could be in the forest.

Read more
[LeetCode] Gray Code

89. Gray Code

An n-bit gray code sequence is a sequence of 2n integers where:

  • Every integer is in the inclusive range [0, 2n - 1],
  • The first integer is 0,
  • An integer appears no more than once in the sequence,
  • The binary representation of every pair of adjacent integers differs by exactly one bit, and
  • The binary representation of the first and last integers differs by exactly one bit.

Given an integer n, return any valid n-bit gray code sequence.

Read more
[Codeforces] Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) C. Alice and the CakeRead more
[Codeforces] Round #790 (Div. 4) H1. Maximum Crossings (Easy Version)Read more
[Hacker Rank] Subset ComponentRead more
[Hacker Rank] Floyd : City of Blinding LightsRead more
[Hacker Rank] Jack goes to RaptureRead more
[Hacker Rank] Snakes and Ladders: The Quickest Way UpRead more
[LeetCode] Equal Tree Partition

663. Equal Tree Partition

Given the root of a binary tree, return true if you can partition the tree into two trees with equal sums of values after removing exactly one edge on the original tree.

Read more