[C++&Rust]LeetCode No.692 top K high frequency words (one question per day)

Original address: http://blog.leanote.com/post/dawnmagnet/lc692 subject Give a non empty word list and return the first k words with the most occurrences. The returned answers should be sorted by word frequency from high to low. If different words have the same frequency, sort them alphabetically. Example 1: input: ["i", "love", "leetcode" ...

Posted by don_s on Wed, 09 Feb 2022 02:28:29 +0100

The integer power of the offer 16 value of the sword finger

Realize pow(x, n), that is, calculate the N-power function of X (i.e., xn). Library functions should not be used and large numbers should not be considered. Example 1: Input: x = 2.00000, n = 10 Output: 1024.00000 Example 2: Input: x = 2.10000, n = 3 Output: 9.26100 Example 3: Input: x = 2.00000, n = -2 Output: 0.25000 Explanation: 2-2 = ...

Posted by Aethaellyn on Tue, 08 Feb 2022 23:06:07 +0100

leetcode 468. Verify IP address

Title Description Write a function to verify whether the input string is a valid IPv4 or IPv6 address. If it is a valid IPv4 address, return "IPv4"; If it is a valid IPv6 address, return "IPv6"; If it is not the IP address of the above type, return "Neither". IPv4 addresses are represented by decimal numbers and do ...

Posted by delboy1978uk on Tue, 08 Feb 2022 20:02:15 +0100

[LeetCode] record of the 71st biweekly competition

Time: 22:30-24:00, February 5, 2022 Address: Competition - leetcode Outcome: 5984. Minimum sum of the last four digits after splitting Difficulty: simple I'll give you a four digit , positive integer , num. Please use the , digit in , num , and split , num , into two new integers , new1 , and , new2. New1 , and , new2 , ca ...

Posted by Mel on Tue, 08 Feb 2022 14:46:16 +0100

Total permutation problem

Full permutation has two enumeration orders:(1) Enumerate which number to fill in each position in order(2) Enumerate each number in order and fill in which positionBoth orders can be solved, but if you want to ensure the dictionary order, you need to use (1) enumerate which number to fill in each position in order. Because the priority is to p ...

Posted by jeethau on Tue, 08 Feb 2022 09:05:05 +0100

[C++&Rust]No.1190 inverts the substring between each pair of parentheses

Original post address: http://blog.leanote.com/post/dawnmagnet/lc1190 subject Give a string {s (containing only lowercase letters and parentheses). Please reverse each pair of matching strings in parentheses layer by layer in the order from inside to outside parentheses, and return the final result. Note that your results should not cont ...

Posted by ramas on Tue, 08 Feb 2022 08:30:38 +0100

[sword finger Offer] personal learning notes_ 68_ Nearest common ancestor of binary search tree

Brushing date: 7:49 am Sunday, May 30, 2021 Personal question brushing records and code collection are all from leetcode After much discussion and consultation, we now intend to work in the direction of Java The main answer language is Java Title: Sword finger Offer 68 - I. nearest common ancestor of binary search tree Simple d ...

Posted by npsari on Tue, 08 Feb 2022 02:50:43 +0100

LeetCode342. Power of 4 / game 243

342. Power of 4 2021.5.31 daily question, I'm glad to receive the badge again this month! Title Description Given an integer, write a function to determine whether it is a power of 4. If yes, return true ;Otherwise, return false . integer n Is the power of 4, which must be satisfied: there is an integer x bring n == 4x Example 1: Input ...

Posted by Cyberspace on Mon, 07 Feb 2022 22:32:31 +0100

Leetcode problem solving - Mathematics

Leetcode problem solving - Mathematics 204. Count prime Count the number of all prime numbers less than non negative integer n. (the definition of prime is very simple. If a number can only be divided by 1 and itself, then the number is prime.) Input: n = 10 Output: 4 Explanation: there are four prime numbers less than 10, They are two, 3, ...

Posted by JoCitizen on Mon, 07 Feb 2022 08:54:15 +0100

[Likou daily question] longest happy string

Li Kou daily question 20207 Topic description If the string does not contain any strings such as' aaa ',' bbb 'or' ccc 'as substrings, the string is a "happy string". Here are three integers a, b and c. please return any string s that meets all the following conditions: s is a happy string as long as possible. There are at mo ...

Posted by kailien on Mon, 07 Feb 2022 06:43:19 +0100