Eat Study Love

먹고 공부하고 사랑하라

C 90

Search a 2D Matrix II[M,Array,Binary Search,Divide and Conquer,Matrix]

https://leetcode.com/problems/search-a-2d-matrix-ii/description/Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in each column are sorted in ascending from top to bottom. Example 1:Input: matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16..

Coding_Practice 2024.10.16

MinMaxDivision(Divide array A into K blocks and minimize the largest sum of any block)

https://app.codility.com/programmers/lessons/14-binary_search_algorithm/min_max_division/ MinMaxDivision coding task - Learn to Code - CodilityDivide array A into K blocks and minimize the largest sum of any block.app.codility.comYou are given integers K, M and a non-empty array A consisting of N integers. Every element of the array is not greater than M.You should divide this array into K block..

Coding_Practice 2024.10.16

Longest Nice Substring[Hash Table,String,Divide and Conquer,Bit Manipulation,Sliding Window]

https://leetcode.com/problems/longest-nice-substring/description/A string s is nice if, for every letter of the alphabet that s contains, it appears both in uppercase and lowercase. For example, "abABB" is nice because 'A' and 'a' appear, and 'B' and 'b' appear. However, "abA" is not because 'b' appears, but 'B' does not.Given a string s, return the longest substring of s that is nice. If there ..

Coding_Practice 2024.10.10

Sort List[Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort]

https://leetcode.com/problems/sort-list/description/Given the head of a linked list, return the list after sorting it in ascending order. Example 1:Input: head = [4,2,1,3]Output: [1,2,3,4]Example 2:Input: head = [-1,5,3,4,0]Output: [-1,0,3,4,5]Example 3:Input: head = []Output: [] Constraints:The number of nodes in the list is in the range [0, 5 * 104].-105  Follow up: Can you sort the linked lis..

Coding_Practice 2024.10.10

Majority Element[Array,Hash Table,Divide and Conquer,Sorting,Counting]

https://leetcode.com/problems/majority-element/description/Given an array nums of size n, return the majority element.The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. Example 1:Input: nums = [3,2,3]Output: 3Example 2:Input: nums = [2,2,1,1,1,2,2]Output: 2 Constraints:n == nums.length1 -109  Follow-up: C..

Coding_Practice 2024.10.10