LeetCode 73. Set Matrix Zeroes
·
Algorithm/문제풀이
Set Matrix Zeroes - LeetCodeCan you solve this real interview question? Set Matrix Zeroes - Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's. You must do it in place [https://en.wikipedia.org/wiki/In-place_algorithm]. Example 1: [httpsleetcode.com 문제 설명m x n 크기의 정수 행렬 matrix가 주어진다.행렬의 원소 중 0이 존재할 경우, 해당 원소가 속한 행과 열의 모든 원소를 0으로 변경해야 한다. 추가 도전- O(mn)..
LeetCode 4. Median of Two Sorted Arrays
·
Algorithm/문제풀이
Median of Two Sorted Arrays - LeetCodeCan you solve this real interview question? Median of Two Sorted Arrays - Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1leetcode.com문제 설명크기가 m인 정렬된 배열 nums1 , 크기가 n인 정렬된 배열 nums2가 주어질 때 두 배열을 합쳤을 때 정렬된 배열의 중앙값을 반환하라실행시간 복잡도는 ..
LeetCode 33. Search in Rotated Sorted Array
·
Algorithm/문제풀이
Search in Rotated Sorted Array - LeetCodeCan you solve this real interview question? Search in Rotated Sorted Array - There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly left rotated at an unknown index k (1 leetcode.com 문제 설명nums배열은 원래 오름차순으로 정렬된 배열에서 왼쪽으로 k번 회전한 배열이다예를 들러 nums가 [4,5,6,7,0,1,2] 로 주어지면원래 배열인 [0..
LeetCode 300. Longest Increasing Subsequence
·
Algorithm/문제풀이
Longest Increasing Subsequence - LeetCodeCan you solve this real interview question? Longest Increasing Subsequence - Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longestleetcode.com문제 설명가장 기본적인 LIS 문제. nums 배열에서 가장 긴 증가하는 부분 수열의 길이를 반환하라.입력: nums = [10,9,2,5,3,7,101,18]출..
LeetCode 18. 4Sum
·
Algorithm/문제풀이
4Sum - LeetCodeCan you solve this real interview question? 4Sum - Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: * 0 leetcode.com문제 설명정수 n개의 nums 배열이 주어질 때 이 배열에서 4개의 수를 골라 이 값들을 다 더하여 target에 도달하는 고유한 4중 배열을 반환하시오 입력: nums = [1,0,-1,0,-2,2], target = 0출력: [[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]] 입력: nums = [2,2,2,2,2]..
LeetCode 329. Longest Increasing Path in a Matrix
·
Algorithm/문제풀이
Longest Increasing Path in a Matrix - LeetCodeCan you solve this real interview question? Longest Increasing Path in a Matrix - Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or down.leetcode.com 문제 설명2차원 행렬이 주어졌을 때 행렬에서 가장 긴 증가하는 경로의 길이를 구하시오입력: matrix = [[9,9,4],[6,6,8],[2,1,1]..