분류 전체보기305 [정처기]2022.10.16 실기 시험보고 합격함 네트워크와 보안.. 너무 재미없어서 날림으로 공부한 파트가 발목을 잡음 ㅋ 약수의 합이 원래 숫자가 되는거 갯수를 6부터 30까지 세라는 문제나 999보다 작은 3의 배수이되 2의 배수가 아닌 가장 큰 숫자를 쓰라는 문제 재밌었다 ㅋ 이건 3을 두번만 빼면 쉬웠고 약수의 합 문제가 코드로만 써두면 뭐하는지 파악해서 원시적인 방법으로 ... 숫자랑 약수 다 써가며.. 답 찾는데 이건 좀 노가다였어도 걍 코드 이해하는게 재밌어서 진짜 오랜만에 심장뛰더라 시험보는데 나.. 이런게 좋아서 이 전공을 택했었지.. 이러면서 내가 살아온 인생(은 과장이고 21살~23살때쯤 열정에 넘치던 나) 주마등 싸악 스치고 빨리 코테문제풀고 알고리즘 공부하고싶어서 벅차오름 ㅋㅋ 시험 망쳐놓고 꿈만 크다 ---라고 생각했는데 .. 2023. 9. 4. 5. Longest Palindromic Substring 문제 주소 https://leetcode.com/problems/longest-palindromic-substring/ len(longest)): longest = temp return longest; Input s = "babad" Output "bab" Expected "bab" Input s = "cbbd" Output "" Expected "bb" j-i면 i,j가 1차이날때 2개 비교하게 계획했는데 1개밖에 안 돌아가는 거 같아서 for k in range(j-i+1): 여기 고쳤더니 되긴 되는데 시간초과됨 temp 넣고 읽는걸 줄여봄 class Solution: def longestPalindrome(self, s: str) -> str: longest = ""; for i in range(l.. 2023. 7. 20. 4. Median of Two Sorted Arrays 문제 주소 https://leetcode.com/problems/median-of-two-sorted-arrays/ Median of Two Sorted Arrays - LeetCode Can you solve this real interview question? Median of Two Sorted Arrays - Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1 leetcode.com 문제 Given two sorted arrays .. 2023. 7. 20. 3.Longest Substring Without Repeating Characters 문제 주소 https://leetcode.com/problems/longest-substring-without-repeating-characters/ int: input = list(map(int, str(num))) temp = [] longest = 0 i=0 j=1 longest = thislist[i:j] while(jlongest): longest = temp break; i++; return longest; 처음에는 i를 고정시키고 j만 움직이려고 했는데 곧 그게 잘못되었단걸 알게되었다 왜냐하면 모든 원소가 새 원소 후보랑 같은지 비교해야 했기 때문이다 그래서 while루프 대신에 for 루프를 쓰기로 했다 To insert at the end, do this temp.insert(len(te.. 2023. 7. 20. 2. Add Two Numbers 이때 푼 풀이에서는 숫자를 다루다보니 소숫점이 많아지면 값이 미묘하게 달라져서 스트링으로 취급해봄 : https://greedydeveloper.tistory.com/64 Given Problem You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the .two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading ze.. 2023. 7. 20. 1.1 Two Sum 파생문제(자작) 문제 똑바로 안 읽고 첫줄을 알아서 스킵해버림 그 결과 엄청나게 어려운 문제로 바뀌었다 이거 푼다고 3시간이나 붙어있었는데 ㅋㅋㅋㅋ 그럴 문제가 아니었음을... input List에 들어있는 숫자의 조합으로 결과값을 만든다 List[int]: col = 1; row = len(nums); for i in range(len(nums)): col = col*2 array = [[0 for c in range(col)] for r in range(row)] end = col; for i in range(row): end = end/2; count = False; for j in range(col): if(j%end == 0): count = not count; if(count == True): array[i].. 2023. 1. 2. 1.Two Sum 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] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. Exa.. 2023. 1. 2. 파이썬 기본 출력 기본출력 print()함수 print("Hello, World!") 2022. 8. 5. 파이썬 기초 문법 더보기 기본출력 print("Hello, World!") 2022. 8. 5. 이전 1 ··· 28 29 30 31 32 33 34 다음