전체 글
-
31. Next PermutationLeetcode 2021. 6. 16. 15:12
31. Next Permutation Medium 59131980Add to ListShare Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order). The replacement must be in place and use only constant extra memory. Example 1: Input: nums = [1,2,3] O..
-
[dacon] 와인품질 EDA 및 1차 모델 개발ML&DL 2021. 6. 14. 15:35
https://dacon.io/competitions/open/235610/overview/description [화학] 와인 품질 분류 출처 : DACON - Data Science Competition dacon.io 위 데이터를 활용했고, 기존에 작성했던 EDA글을 토대로 진행했다. 여기서 예측해야 하는 Y는 quality이며, 나머지는 feature로 사용해야 한다. 전체 컬럼의 null값은 없고, type만 object 타입인 것을 확인할 수 있다. red, white 계열의 type만 존재하므로 df['type'] = df['type'].replace(['red', 'white'], [0, 1]) 인코딩을 진행했다. 여기선 생략됐지만, 각 컬럼별로 분포가 다르다. scaling을 진행해야 한다..
-
-
29. Divide Two IntegersLeetcode 2021. 5. 25. 16:25
Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. Return the quotient after dividing dividend by divisor. The integer division should truncate toward zero, which means losing its fractional part. For example, truncate(8.345) = 8 and truncate(-2.7335) = -2. Note: Assume we are dealing with an environment that could only store in..
-
28. Implement strStr()Leetcode 2021. 5. 25. 15:57
Implement strStr(). 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 needle is an empty string. This is consistent to C's strstr() and Java's indexOf(). Example 1: I..
-
27. Remove ElementLeetcode 2021. 5. 25. 15:38
Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond the new length. Clarification: Confused why the returned value is an integer but your ..
-
26. Remove Duplicates from Sorted ArrayLeetcode 2021. 5. 25. 15:35
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Clarification: Confused why the returned value is an integer but your answer is an array? Note that the input array is passed in by reference, wh..
-
25. Reverse Nodes in k-GroupLeetcode 2021. 5. 25. 14:12
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is. You may not alter the values in the list's nodes, only nodes themselves may be changed. Example 1: Input: head = ..