Leet code problem 1423: – Maximum Points You Can Obtain from Cards

There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints. In one step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards. Your score is the…

Leet code problem 1419: – Minimum Number of Frogs Croaking Medium

Given the string croakOfFrogs, which represents a combination of the string “croak” from different frogs, that is, multiple frogs can croak at the same time, so multiple “croak” are mixed. Return the minimum number of different frogs to finish all the croak in the given string. A valid “croak” means a frog is printing 5…

Leet code problem 1418: – Display Table of Food Orders in a Restaurant

Given the array orders, which represents the orders that customers have done in a restaurant. More specifically orders[i]=[customerNamei,tableNumberi,foodItemi] where customerNamei is the name of the customer, tableNumberi is the table customer sit at, and foodItemi is the item customer orders.Return the restaurant’s “display table”. The “display table” is a table whose row entries denote how…

Leet code 1417: – Reformat the String

Given alphanumeric string s. (Alphanumeric string is a string consisting of lowercase English letters and digits). You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same type. Return the reformatted string…

Leet code problem 1415: – The k-th Lexicographical String of All Happy Strings of Length n Medium

A happy string is a string that: For example, strings “abc”, “ac”, “b” and “abcbabcbcb” are all happy strings and strings “aa”, “baa” and “ababbc” are not happy strings. Given two integers n and k, consider a list of all happy strings of length n sorted in lexicographical order.Return the kth string of this list…

Leet code problem 1414: – Find the Minimum Number of Fibonacci Numbers Whose Sum Is K Medium

Given an integer k, return the minimum number of Fibonacci numbers whose sum is equal to k. The same Fibonacci number can be used multiple times. The Fibonacci numbers are defined as: It is guaranteed that for the given constraints we can always find such Fibonacci numbers that sum up to k. Example 1: Input:…

Leet Code problem 1410: – HTML Entity Parser

HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. The special characters and their entities for HTML are: Given the input text string to the HTML parser, you have to implement the entity parser. Return the text after replacing…