- Today
- Total
목록스터디/코테 (223)
작심삼일
문제 링크: https://leetcode.com/problems/swapping-nodes-in-a-linked-list/ 문제 You are given the head of a linked list, and an integer k. Return the head of the linked list after swapping the values of the $k^{th}$ node from the beginning and the $k^{th}$ node from the end (the list is 1-indexed). 조건 The number of nodes in the list is n. 1
문제 링크: https://leetcode.com/problems/reverse-string/ 문제 Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. 조건 1 None: N = len(s) H = N//2 for n in range(H): s[n], s[N-n-1] = s[N-n-1], s[n]
문제 링크: https://leetcode.com/problems/split-array-largest-sum/ 문제 Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m subarrays. 조건 1
문제 링크: https://leetcode.com/problems/search-a-2d-matrix/ 문제 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 from left to right. The first integer of each row is greater than the last integer of the previous row. 조건 m == matrix.length n == matrix[i].length 1
문제 링크: https://leetcode.com/problems/find-the-duplicate-number/ 문제 Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve the problem without modifying the array nums and uses only constant extra space. 조건 1
문제 링크: https://leetcode.com/problems/search-in-rotated-sorted-array-ii/ 문제 There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is rotated at an unknown pivot index k (0
문제 링크: https://leetcode.com/problems/two-city-scheduling/ 문제 A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti], the cost of flying the ith person to city a is aCosti, and the cost of flying the ith person to city b is bCosti. Return the minimum cost to fly every person to a city such that exactly n people arrive in each city. 조건 2 * n == costs...
문제 링크: https://leetcode.com/problems/boats-to-save-people/ 문제 You are given an array people where people[i] is the weight of the $i^{th}$ person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most limit. Return the minimum number of boats to carry eve..