[LeetCode]No.4. Median of Two Sorted Arrays -- Java Version

Title Link: https://leetcode.com/problems/median-of-two-sorted-arrays/ 1. Topic Introduction (combine two arrays to find the median value) Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. [Translate]: given two ordered arrays nums1 and nums2 with sizes of m and n respectively, ...

Posted by vigiw on Wed, 06 Apr 2022 09:17:06 +0300

LeetCode brush questions - 4 Find the median of two positively ordered arrays -- binary search

My solution: binary search class Solution { public:     double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {                  if(nums1.size()>nums2.size()){             auto temp=nums1;             nums1=nums2;             nums2=temp;         }         int m=nums1.size();         int n= ...

Posted by Pilli on Tue, 05 Apr 2022 10:39:21 +0300

Leetcode 654. Maximum binary tree

654. Maximum binary tree Give a non repeating integer array nums. The maximum binary tree can be constructed recursively from nums with the following algorithm: Create a root node with the maximum value in nums. Recursively construct the left subtree on the subarray prefix to the left of the maximum. Recursively construct the right subtree on ...

Posted by vhaxu on Tue, 05 Apr 2022 09:39:51 +0300

LeetCode algorithm -- recursion + dynamic programming

Day 11 - recursion 77. Portfolio Combination and arrangement are classical recursive backtracking problems, and can be optimized by pruning techniques. Method 1: non pruning recursive backtracking method The combination does not consider the order. M numbers are selected from the given N numbers for combination, and the combined numbers ...

Posted by MajusC00L on Tue, 05 Apr 2022 08:50:12 +0300

Analysis of four shell programming problems on LeetCode

LeetCode 192 01 Title Description Write a bash script to count a text file words The frequency of each word in txt. For simplicity, you can assume: 1. words.txt includes only lowercase letters and ''.   2. Each word consists of only lowercase letters.   3. Words are separated by one or more space characters.   02 (word ...

Posted by phpbeginner on Tue, 05 Apr 2022 07:02:51 +0300

Leetcode daily question-1047224232

Daily leetcode 1047. Delete all adjacent duplicates in the string describe Given a string consisting of lowercase letters, {S, the duplicate deletion operation will select two adjacent and identical letters and delete them. Repeat the duplicate deletion operation on S until the deletion cannot continue. Returns the final string after all dedup ...

Posted by cyrixware on Mon, 04 Apr 2022 08:22:49 +0300

One handed kill through classic linked list question Pt 3 - LeetCode ladder crossing robbery

Traditional artistic ability 😎 Xiaobian is a freshman with double non undergraduate courses. I won't repeat it. You are welcome to give advice (QQ: 1319365055) Previous blogs Point me! Point me! Please search blogger [know the blue of the sky] Joe Joe's gitee code base (grey man) Welcome to visit, click me! 🎉🎉 Non Keban transcoding com ...

Posted by khaldryck on Mon, 04 Apr 2022 07:37:10 +0300

leetcode question 15 - sum of three numbers

I need to wait for my roommate before dinner and write down the process of solving this problem. Sum of three Post a picture first Violent solution   the violence here is reflected in two aspects: one is to find three numbers in the cycle of violence, and the other is to judge whether the current solution is already concentrated. D ...

Posted by Mikester on Sun, 03 Apr 2022 07:21:29 +0300

212. Word search II

212. Word search II Title Description Given an m x n two-dimensional character grid board and a word (string) list words, find all the words that appear in the two-dimensional grid and dictionary at the same time. Words must be formed alphabetically by letters in adjacent cells, where "adjacent" cells are those horizontally or vert ...

Posted by MrBiz on Sun, 03 Apr 2022 04:24:21 +0300

The first job of windows programming

Arrays and strings 1, One dimensional array 1. Find the central index of the array Title Description: An integer array nums, write a method that can return the "central subscript" of the array The central subscript of the array is a subscript of the array. The sum of all elements on the left is equal to the sum of all elemen ...

Posted by lostincoding on Sat, 02 Apr 2022 04:22:49 +0300