2661. First Completely Painted Row or Column
·
Algorithm/Leetcode
https://leetcode.com/problems/first-completely-painted-row-or-column/description/?envType=daily-question&envId=2025-01-20 You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n].Go through each index i in arr starting from index 0 and paint the cell in mat containing the integer arr[i].Return the smallest ind..
백트래킹 문제들
·
Algorithm/Leetcode
79. Word Search https://leetcode.com/problems/word-search/description/?envType=problem-list-v2&envId=backtracking 2차원 배열을 순회하면서 word로 주어진 값을 만들 수 있는지 판단하는 문제였다.현재 좌표에서 동서남북, 4방향으로 이동하는 것도 염두에 둬야 했던 문제였다. 39. Combination Sumhttps://leetcode.com/problems/combination-sum/description/ Input: candidates = [2,3,6,7], target = 7 Output: [[2,2,3],[7]] Explanation: 2 and 3 are candidates, and 2 + 2 + 3 =..
934. Shortest Bridge
·
Algorithm/Leetcode
https://leetcode.com/problems/shortest-bridge/description/ You are given an n x n binary matrix grid where 1 represents land and 0 represents water.An island is a 4-directionally connected group of 1's not connected to any other 1's. There are exactly two islands in grid.You may change 0's to 1's to connect the two islands to form one island.Return the smallest number of 0's you must flip to con..
3223. Minimum Length of String After Operations
·
Algorithm/Leetcode
https://leetcode.com/problems/minimum-length-of-string-after-operations/description/?envType=daily-question&envId=2025-01-13 You are given a string s.You can perform the following process on s any number of times:Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one character to the right that is also equal to s[i..
916. Word Subsets
·
Algorithm/Leetcode
https://leetcode.com/problems/word-subsets/description/?envType=daily-question&envId=2025-01-10 You are given two string arrays words1 and words2.A string b is a subset of string a if every letter in b occurs in a including multiplicity.For example, "wrr" is a subset of "warrior" but is not a subset of "world".A string a from words1 is universal if for every string b in words2, b is a subset of ..
성능 테스트 툴 선정 및 테스트 결과
·
프로젝트/PICK-O
밸런스 게임 도메인저희 PICK-O 서비스에선 크게 두가지 주제로 사용자가 글을 작성하거나 조회할 수 있는데요, '톡픽'과 '밸런스 게임'이 그 두가지 입니다. 밸런스 게임의 경우, 한 세트당 10개의 게시글을 작성해야 하며 제목, 상황 설명, 사진 첨부 등을 할 수 있습니다.  밸런스 게임을 조회하는 방법은 현재 4가지가 있습니다.인기순으로 밸런스 게임을 조회태그값을 기준으로 인기순 조회현재 밸런스 게임의 태그값은 취향, 커플, 월드컵이 있습니다.최신순으로 밸런스 게임 조회밸런스 게임 단건 상세조회 따라서, 4가지 API에 대해서 유저가 많은 상황을 가정하여 성능테스트를 진행했습니다.성능 테스트 툴 선택 기준저희 팀은 성능 테스트를 k6로 사용하기로 했는데, 결정하기에 앞서 Ngrinder, K6, J..
542. 01 Matrix
·
Algorithm/Leetcode
https://leetcode.com/problems/01-matrix/description/?envType=problem-list-v2&envId=breadth-first-search    Input: mat = [[0,0,0],[0,1,0],[1,1,1]]Output: [[0,0,0],[0,1,0],[1,2,1]]  1에서부터 가장 가까운 0의 값을 배열에 저장해주면 되는 문제였다. 배열이 0이라면 큐에 삽입1이라면, -1로 초기화를 해준다 (거리 값 초기화)배열이 0인 곳에서부터 탐색을 하면서 거리가 -1인 곳을 계속해서 갱신해나가면 되는 문제였다.  정답 코드class Solution { int n, m; int [] dx = {1,0,-1,0}; int [] dy = {0,1,0..
78. Subsets
·
Algorithm/Leetcode
https://leetcode.com/problems/subsets/description/ Given an integer array nums of unique elements, return all possible subsets (the power set).The solution set must not contain duplicate subsets. Return the solution in any order. 배열이 주어질 때, 해당 배열의 모든 부분집합을 리턴하는 문제였다. (공집합 포함)해당 문제를 풀면서 느꼈던 것은 자바의 List 인터페이스 메서드에 대해서 잘 모르고 쓰고있구나 하는 생각이 들었다. 문제를 풀다가 List 형태에 Integer 값인 nums[i]를 추가했더니 error: incomp..
494. Target Sum
·
Algorithm/Leetcode
https://leetcode.com/problems/target-sum/description/?envType=daily-question&envId=2025-01-04 You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate th..
1930. Unique Length-3 Palindromic Subsequences
·
Algorithm/Leetcode
https://leetcode.com/problems/unique-length-3-palindromic-subsequences/description/?envType=daily-question&envId=2025-01-04 주어진 문자열 s에서 길이가 3이고 중복되지 않은 팰린드롬의 갯수를 구하는 문제였다. 나는 백트래킹을 통해서 길이가 3인 모든 문자열을 찾아 Set에 넣어 중복되지 않은 문자열들을 구했다. 그 다음에, Set을 순회하며 해당 문자열이 팰린드롬인지 판단해주었다. 예제는 통과했지만, s의 길이가 10만이기 때문에 백트래킹을 시도했을 때 당연히 시초가 터졌다. 시간복잡도를 O(nlogn), 혹은 O(n) 이하로 줄일 방법을 찾아야 했다. 정답 풀이)class Solution { publ..