노트(211)
-
[leetcode] 9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Follow up: Could you solve it without converting the integer to a string? 1. str 으로 바꿔서 한글자씩 분리해서 푸는 방법 class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if -pow(2,31)
2020.11.11 -
[leetcode] 7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer. Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows. 1. str 으로 바꿔서 한글자씩 분리해서 푸는 방법 class Solution(object): def reverse(self, x): """ :type x: int :r..
2020.11.11 -
[Pandas] Pandas를 마스터하기 위한 30가지 예제
30 Examples to Master Pandas A comprehensive practical guide for learning Pandas Pandas is a widely-used data analysis and manipulation library for Python. It provides numerous functions and methods that expedite the data analysis and preprocessing steps. Due to its popularity, there are lots of articles and tutorials about Pandas. This one will be one of them but heavily focusing on the practic..
2020.11.09 -
[CS] 이진탐색트리(Binary Search Tree) 구현하기 python code
이진 탐색트리(Binary Search Tree) 구현하기 우리의 트리 클래스는 다음과 같은 기능을 제공해야 한다. 새로운, 비어있는 이진 트리 맵을 생성한다. 이는 클래스의 인스턴스를 생성하는 것이다. 키, 값 쌍의 데이터를 받아서 트리에 추가한다. put(key, value)의 형태로 메소드를 만들 것이다. 키를 이용해서 해당 키에 연결된 값을 얻을 수 있다. get(key)를 구현할 것이다. 특정 키를 주고, 해당 키를 트리 내에서 탐색한다. contains(key)의 메소드를 구현한다. 특정 키를 주고, 해당 키를 트리 내에서 제거한다. delete(key) 의 메소드를 구현한다. 코드 기본적인 노드 클래스 구현 ## 기본적인 노드 클래스 구현 class TreeNode: def __init__(..
2020.11.03 -
[leetcode] 3. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating Characters Given a string s, find the length of the longest substring without repeating characters. 방법1 NO_OF_CHARS = 256 class Solution: def lengthOfLongestSubstring(self,s): """ :type s: str :rtype: int """ # 마지막 인덱스 array를 -1로 초기화 lastIndex = [-1] * NO_OF_CHARS n = len(s) res = 0 i = 0 for j in range(0,n): # str[j]의 마지막 인덱스를 찾아서 +1을 하고 # 현재 i 값과 last의 최댓..
2020.11.02 -
[분류] KNN 알고리즘을 이용한 데이터 분류하기
중고차 데이터 usedcars
2020.10.24