Algorithm/LeetCode 8

[LeetCode - 1375] Number of Times Binary String Is Prefix-Aligned - Java

문제 설명 Number of Times Binary String Is Prefix-Aligned - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 접근 방법 나의 접근 방법 flips 배열 크기의 boolean형 배열을 생성 후 flips 값 순서대로 해당 배열의 인덱스에 true를 할당해주었습니다. 이후 배열의 인덱스가 1부터 현재 단계의 수(n'th step)까지 모두 true일 경우 결과값에 1을 더해주도록 했습니다. 하지만, 이 경우 flips 값과 상관..

Algorithm/LeetCode 2022.09.11

[LeetCode - 3] Longest Substring Without Repeating Characters - Java

문제 설명 Longest Substring Without Repeating Characters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이 : Success 소스 코드 class Solution { public int lengthOfLongestSubstring(String s) { if (s.length() == 0) return 0; else if (s.length() == 1) return 1; int result = 0; String temp ..

Algorithm/LeetCode 2022.02.25