꾸준히 재밌게
728x90
728x90
article thumbnail
[Java] 2466. Count Ways To Build Good Strings - LeetCode Daily Challenge / Dynamic Programing(DP)
코딩테스트/leetcode 2023. 5. 13. 21:44

Count Ways To Build Good Strings - LeetCode Can you solve this real interview question? Count Ways To Build Good Strings - Given the integers zero, one, low, and high, we can construct a string by starting with an empty string, and then at each step perform either of the following: * Append the char leetcode.com 풀이 DP배열을 생성해, Bottom Up방식으로 풀이. dp[0]=1이 왜 1인가에 대해 고민을 좀 많이 했던 문제였다. 문자열의 길이가 0인게 없지..

article thumbnail
[Java] 2140. Solving Questions With Brainpower - LeetCode Daily Challenge
코딩테스트/leetcode 2023. 5. 12. 14:32

Solving Questions With Brainpower - LeetCode Can you solve this real interview question? Solving Questions With Brainpower - You are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri]. The array describes the questions of an exam, where you have to process the qu leetcode.com 풀이 DFS를 이용해서, 해당 칸을 탐색할 수 있을 경우 탐색해서 모든 경우의수를 구한다음 최대값을 구하는 단순 DFS문제라고 생각했다. class ..

article thumbnail
[Java] 1035. Uncrossed Lines - LeetCode Daily Challenge / Dynamic Programing(DP)
코딩테스트/leetcode 2023. 5. 12. 06:57

Uncrossed Lines - LeetCode Can you solve this real interview question? Uncrossed Lines - You are given two integer arrays nums1 and nums2. We write the integers of nums1 and nums2 (in the order they are given) on two separate horizontal lines. We may draw connecting lines: a straigh leetcode.com 풀이 DP배열의 idx의 값은 해당 idx까지 서로 탐색을했을때, 겹치지 않는 최대 경우의 수를 나타낸다. class Solution { public int maxUncrossedL..

article thumbnail
[Java] 59.Spiral Matrix II - LeetCode Daily Challenge
코딩테스트/leetcode 2023. 5. 10. 21:15

https://leetcode.com/problems/spiral-matrix-ii/ Spiral Matrix II - LeetCode Can you solve this real interview question? Spiral Matrix II - Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: [https://assets.leetcode.com/uploads/2020/11/13/spiraln.jpg] Input: n = 3 O leetcode.com 풀이 방향에 대한 변수와, 한 칸씩 체크해줄 변수를 지정해 준 뒤, 카운팅만 잘 해주면 되는 문제였..

article thumbnail
[Java] 54. Spiral Matrix - LeetCode daily challenge
코딩테스트/leetcode 2023. 5. 9. 19:09

https://leetcode.com/problems/spiral-matrix/ Spiral Matrix - LeetCodeCan you solve this real interview question? Spiral Matrix - Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: [https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg] Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Outpuleetcode.com 첫번째풀이두통이 조금 심한 날이라 깊게 생각하기 싫었다. 처음 생각난게 DFS, 두번째로 생각난건 while문으로..

article thumbnail
[Java] 64.Minimum Path Sum - LeetCode / Dynamic Programing(DP)
코딩테스트/leetcode 2023. 5. 7. 07:35

https://leetcode.com/problems/minimum-path-sum/ Minimum Path Sum - LeetCodeCan you solve this real interview question? Minimum Path Sum - Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. Note: You can only move either down or rigleetcode.com 풀이이차원배열 grid에서, 오른쪽, 아래로만 이동할 수 있을 때, 모든 숫자의 합을 최소화 하는..

728x90
728x90