[sword finger offer] minimum number of k

🔥 subject Enter the integer array arr to find the minimum number of k.   ☘️ analysis Solution 1 - simple sorting First of all, you can think of a very simple idea: sort the data from small to large, and take the first k numbers. Analysis: time complexity O(nlogn), that is, sorting overhead. It's not hard to think of a problem. We only ...

Added by agoni on Wed, 29 Dec 2021 08:08:33 +0200

LeetCode notes: Biweekly Contest 68

LeetCode notes: Biweekly Contest 68 1. Topic 1 1. Problem solving ideas2. Code implementation 2. Topic 2 1. Problem solving ideas2. Code implementation 3. Topic 3 1. Problem solving ideas2. Code implementation 4. Topic 4 1. Problem solving ideas2. Code implementation 1. Topic 1 The test question link given in questi ...

Added by secoxxx on Tue, 28 Dec 2021 10:30:32 +0200

c + + problem solving report (continuously updated)

The original intention of writing this article is to sort out and review the questions you have brushed 1. Sum of two numbers 1. Sum of two numbers Given an integer array nums and an integer target value target, please find the two integers with and as the target value target in the array and return their array subscripts. You can assume ...

Added by Visualant on Tue, 28 Dec 2021 03:29:40 +0200

USACO 2011 Nov. [Bronze] P4. Cow Beauty Pageant

Original address: http://www.usaco.org/index.php?page=viewproblem2&cpid=87 Title Description Hearing that the latest fashion trend was cows with two spots on their hides, Farmer John has purchased an entire herd of two-spot cows. Unfortunately, fashion trends tend to change quickly, and the most popular current fashion is cows with only on ...

Added by dayo on Tue, 28 Dec 2021 00:30:35 +0200

[LeetCode] alternately print FooBar (multithreaded) java

subject Give you a class: class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n; i++) { print("bar"); } } } Two different threads will share a FooBar instance: Thread A will call the foo() method, and Thread B will call the bar ...

Added by shane18 on Tue, 28 Dec 2021 00:12:19 +0200

LeetCode array of question brushing records

In order from simple to difficult, break through the hurdles in turn (the title number is the serial number of leetcode) Main JAVA Source: https://leetcode-cn.com/ catalogue 1. Sum of two numbers (1) - hash table lookup 2. Delete duplicates in the ordered array (26) -- double pointers 3. Remove element (27) - Optimization of double pointe ...

Added by klycette on Mon, 27 Dec 2021 21:28:02 +0200

262. Travel and users

Tip: after the article is written, the directory can be generated automatically. Please refer to the help document on the right for how to generate it preface Tip: Here you can add the general contents to be recorded in this article: For example, with the continuous development of artificial intelligence, machine learning technology is ...

Added by aiikcmo on Mon, 27 Dec 2021 09:25:53 +0200

2021-08-09 design hash set

Design hash set of leetcode daily question Title Link: https://leetcode-cn.com/problems/design-hashset/ Topic Description: design a hash set without using any built-in hash table library. Implement the MyHashSet class: void add(key) inserts the value key into the hash set. bool contains(key) Returns whether the value key exists in the hash ...

Added by Derleek on Mon, 27 Dec 2021 06:29:56 +0200

[Christmas special session] after brushing this set of linked list questions, I laughed when the interviewer took the linked list test

⭐ Introduction ⭐ ️ Hello, I'm Zhijie. I believe you all know the importance of data structure and algorithm. Among them, the linked list is the top priority. Many brothers feel that it is nothing more than a single linked list and a double linked list. It is very simple to add, delete, change and query. Indeed, although the linked list is sim ...

Added by shock on Mon, 27 Dec 2021 05:21:03 +0200

Week 253 of leetcode

This week's competition is relatively simple. I wrote three questions in an hour. The last question, I forgot how to write the longest common subsequence of greedy plus two points. dp's card is lost, and I supplemented it after it. 5838. Check whether the string is an array prefix class Solution { public boolean isPrefixString(S ...

Added by warstormer on Sun, 26 Dec 2021 21:12:53 +0200