본문 바로가기

전체 글1635

[LeetCode] 724. Find Pivot Index - Java • 문제 링크 Find Pivot Index - LeetCodeCan you solve this real interview question? Find Pivot Index - Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum ofleetcode.com • 풀이 코드public class Solution { public int pivotIndex(int[] nums) { int l = 0, r = 0; .. 2026. 10. 4.
[LeetCode] 717. 1-bit and 2-bit Characters - Java • 문제 링크 1-bit and 2-bit Characters - LeetCodeCan you solve this real interview question? 1-bit and 2-bit Characters - We have two special characters: * The first character can be represented by one bit 0. * The second character can be represented by two bits (10 or 11). Given a binary array bits thatleetcode.com • 풀이 코드public class Solution { public boolean isOneBitCharacter(int[] bits) { .. 2026. 10. 3.
[LeetCode] 709. To Lower Case - Java • 문제 링크 To Lower Case - LeetCodeCan you solve this real interview question? To Lower Case - Given a string s, return the string after replacing every uppercase letter with the same lowercase letter. Example 1: Input: s = "Hello" Output: "hello" Example 2: Input: s = "here" Output: "heleetcode.com • 풀이 코드public class Solution { public String toLowerCase(String s) { char[] arr = s.toCh.. 2026. 10. 2.
[LeetCode] 706. Design HashMap - Java • 문제 링크 Design HashMap - LeetCodeCan you solve this real interview question? Design HashMap - Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: * MyHashMap() initializes the object with an empty map. * void put(int key, int value) inserts a (leetcode.com • 풀이 코드import java.util.Arrays;public class MyHashMap { private final int[] arr; public My.. 2026. 10. 1.
[LeetCode] 705. Design HashSet - Java • 문제 링크 Design HashSet - LeetCodeCan you solve this real interview question? Design HashSet - Design a HashSet without using any built-in hash table libraries. Implement MyHashSet class: * void add(key) Inserts the value key into the HashSet. * bool contains(key) Returns whether the valueleetcode.com • 풀이 코드public class MyHashSet { private final boolean[] arr; public MyHashSet() { a.. 2026. 9. 30.
[LeetCode] 704. Binary Search - Java • 문제 링크 Binary Search - LeetCodeCan you solve this real interview question? Binary Search - Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.leetcode.com • 풀이 코드public class Solution { public int search(int[] nums, int target) { int l = 0, r.. 2026. 9. 29.