Developer/알고리즘 (3) 썸네일형 리스트형 Leetcode - Two Sum 1. Two Sum Easy Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return.. LeetCode Start 1716. Calculate Money in Leetcode Bank Easy Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. Given n, return the total amount of money he will have .. 알고리즘 python 원소 덧붙이기 .append() 원소 하나를 꺼내기 .pop() i.pop(2) 원소 삽입하기 .insert() i = [20, 37, 58, 72] i.insert [3, 5] 원소 삭제하기 .del() del(i[2]) 원소 탐색하기: .index() i.index('Spam') 함수 def add(x, y): n = x + y return n sort : 정렬 파이썬 내장 함수 sorted() 리스트에 쓸 수 있는 메서드 .sort() i.sort() index : 위치 반환 index(x) 함수는 리스트에 x 값이 있으면 x의 위치 값을 돌려준다. >>> a = [1,2,3] >>> a.index(3) 2 >>> a.index(1) 0 find(찾을문자, 찾기시작할위치) >>> s = '가나다라 .. 이전 1 다음