본문 바로가기

Leetcode4

[leetcode] Roman To Integer 네 .. 저는 하드코딩 하는 사람입니다. 진짜.. 클린코드 하고싶은데. 맘처럼 안되네요. 그래도 아직 저는 초보이니까! 문제를 해결했다는거에 만족을 해보렵니다! 정말 긴... 나의 하드코드.. class Solution { public int romanToInt(String s) { String symbols = "IVXLCDM"; int answer = 0; int length = s.length(); int symLength = symbols.length(); for(int i=0; i 2022. 1. 21.
[leetcode] Roman To Integer 네 .. 저는 하드코딩 하는 사람입니다. 진짜.. 클린코드 하고싶은데. 맘처럼 안되네요. 그래도 아직 저는 초보이니까! 문제를 해결했다는거에 만족을 해보렵니다! 정말 긴... 나의 하드코드.. class Solution { public int romanToInt(String s) { String symbols = "IVXLCDM"; int answer = 0; int length = s.length(); int symLength = symbols.length(); for(int i=0; i 2022. 1. 21.
[leetcode] Palindrome Number 새해를 맞아 다시 알고리즘 공부를 시작해 볼까 합니다. 오늘은 LeetCode에서 9번 Plindrome Number 라는 문제를 풀었어요. 문제는 이러합니다. Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is a palindrome while 123 is not. 그리고 이건 제가 푼 방법 입니다. class Solution { public boolean isPalindrome(int x) { String tmp = String.valueOf(x); String backward = "".. 2022. 1. 9.
[leetcode] two sum 네.. 게으르지만 꾸준히 배우고 싶은 글쓴이입니다. 잘 못하는 코딩이지만, 계속하고 싶은 접니다. 오늘은 leetcode에 가입을 하고, 첫 알고리즘 문제를 풀어 본 경험을 공유합니다. 일단 저는, 비기너이기 때문에.. 얼마만큼의 효율적인 코드냐 보다는, 제가 이 문제를 해결하느냐 못하느냐에 중점을 두기로 했습니다. 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 inpu.. 2021. 10. 8.