All Posts

Leetcode 1400: Construct K Palindrome Strings

You are given a string s and an integer k. Your task is to determine whether it’s possible to use all the characters in the string s to construct exactly k palindromic strings.

Leetcode 1404: Number of Steps to Reduce a Number in Binary Representation to One

You are given a binary string representing a non-negative integer. The task is to determine the number of steps required to reduce this number to 1, following the rules: divide by 2 if the number is even, or add 1 if it is odd. Return the total number of steps required.

Leetcode 1405: Longest Happy String

You are given three integers, a, b, and c, representing the maximum occurrences of ‘a’, ‘b’, and ‘c’ that can appear in a string. Your task is to return the longest string that can be formed using these letters such that it does not contain the substrings ‘aaa’, ‘bbb’, or ‘ccc’. The string should contain at most a occurrences of ‘a’, at most b occurrences of ‘b’, and at most c occurrences of ‘c’.

Leetcode 1410: HTML Entity Parser

You are tasked with decoding a string that contains HTML entities. The HTML entities represent special characters like quotation marks, ampersands, greater-than signs, etc. You need to replace the HTML entities with their respective characters.

Leetcode 1415: The k-th Lexicographical String of All Happy Strings of Length n

A happy string consists of only the letters ‘a’, ‘b’, and ‘c’, and no two consecutive characters in the string are the same. Given two integers n and k, return the kth happy string of length n sorted in lexicographical order, or an empty string if there are fewer than k happy strings of length n.

Leetcode 1418: Display Table of Food Orders in a Restaurant

Given a list of customer orders in a restaurant, return a table where each row represents a table number and the columns represent the number of food items ordered at that table, sorted in lexicographical order.