분류 전체보기49 28. Implement strStr() c++ 28. Implement strStr() Easy 44483768Add to ListShare Implement strStr(). Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when need.. 2022. 7. 7. 1. Two Sum Leetcode 문제 brute force 방식으로 풀었다. 어렵지 않게 이해할 수 있는 코드이다. class Solution { public: vector twoSum(vector& nums, int target) { vector v; for(int i = 0 ; i < nums.size() ; i++) { for(int j = i+1 ; j 2022. 7. 4. 287. Find the Duplicate Number c++ 문제 풀이 각 정수가 [1, n] 범위 내에 있는 n + 1 정수를 포함하는 정수 배열을 지정합니다. 숫자로 반복되는 숫자가 하나뿐입니다. 이 반복된 숫자를 반환합니다. 배열 번호를 수정하지 않고 일정한 추가 공간만 사용하여 문제를 해결해야 합니다. Medium 난이도 Example 1: Input: nums = [1,3,4,2,2] Output: 2 Example 2: Input: nums = [3,1,3,4,2] Output: 3 Constraints: 1 2022. 7. 3. 581. Shortest Unsorted Continuous Subarray c++ 문제 https://leetcode.com/problems/shortest-unsorted-continuous-subarray/description/ Shortest Unsorted Continuous Subarray - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray in asce.. 2022. 6. 23. 이전 1 2 3 4 5 6 ··· 13 다음