개발새발

  • 홈
  • 태그
  • 방명록

28번 1

[LeetCode/Java] 28. Find the Index of the First Occurrence in a String

28. Find the Index of the First Occurrence in a String [문제 설명]문자열 haystack에서 부분 문자열 needle이 처음 등장하는 인덱스를 반환하라.needle이 haystack에 없다면 -1을 반환한다.[문제 조건]needle이 빈 문자열이면 0을 반환한다.needle이 haystack에 없는 경우 -1 반환.[코드]public int strStr(String haystack, String needle) { if (needle.isEmpty()) return 0; int hLength = haystack.length(); int nLength = needle.length(); // haystack의 길이가 needle보다 짧으면 -1..

알고리즘/LeetCode 2025.04.04
이전
1
다음
더보기
프로필사진

개발새발

방문자수Total

  • Today :
  • Yesterday :
  • 분류 전체보기 (102)
    • 네트워크 (7)
      • 기본 (7)
    • Java (22)
      • 기본 (14)
      • 알고리즘 (3)
      • Effective Java (2)
      • 강의 (0)
      • Spring (3)
    • JavaScript (16)
      • 기본 (1)
      • 응용하기 (5)
    • Node.js (11)
      • React (8)
      • Vue (0)
    • Sql (4)
    • 개발 (9)
      • 개발 일상 (2)
      • 개발 지식 (1)
      • 결제 (1)
      • 알면 좋은 (5)
    • Python (13)
      • 기본 (11)
      • 알고리즘 (2)
    • AWS (2)
    • 알고리즘 (18)
      • 개념 (3)
      • Programmers (6)
      • LeetCode (7)
      • 백준 (2)

Copyright © Kakao Corp. All rights reserved.

티스토리툴바