전체 글

    [LeetCode] Longest common prefix

    단어가 들어있는 String 배열에서 가장 긴 공통된 접두어를 구하라. sudo code 가장 긴 단어와 가장 짧은 단어를 고르고 가장 짧은 단어의 길이만큼 긴 단어의 앞에서 부터 비교 차감하면서 비교 같지 않다면 "" 리턴 1차 시도있는 String 배열에서 가장 긴 공통된 접두어를 구하라. sudo code 가장 긴 단어와 가장 짧은 단어를 고르고 가장 짧은 단어의 길이만큼 긴 단어의 앞에서 부터 비교 차감하면서 비교 같지 않다면 "" 리턴 1차 시도 class Solution { public String getShortestWord(String[] strs) { if (strs == null || strs.length < 1) { return ""; } String shortestWord = str..

    [스프링 웹 개발 기초] - 06. 정적 컨텐츠

    MVC와 템플릿 엔진 MVC: Model, View, Controller Controller @GetMapping("hello-mvc") public String helloMvc(@RequestParam("name") String name, Model model) { model.addAttribute("name", name); return "hello-template"; } View resources/template/hello-template.html hello! empty 실행 http://localhost:8080/hello-mvc?name=spring MVC Template engine - mvc패턴을 통해 html을 동적으로 바꿔서 제공 관심사 분리 View는 화면을 그리는데 모든 역량 Contr..

    [스프링 웹 개발 기초] - 05. 정적 컨텐츠

    스프링 부트 정적 컨텐츠 기능 https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-bootfeatures.html#boot-features-spring-mvc-static-content resources/static/hello-static.html resources/static/hello-static.html 정적 컨텐츠 입니다. 실행 http://localhost:8080/hello-static.html 서버에서 가공없이 파일을 그대로 제공하는 것

    [LeetCode] - Reverse Linked List

    Single LinkedList 순서를 역순으로 /* 일단 순회부터 while(head.next != null) { System.out.println(head.val); head = head.next; 1 = 2, 2 = 3, 3 = 4, 4 = 5, 5.next = null } */ // return head; /* public class Main { public static void main(String[] args) { ListNode head = new ListNode(5,null); head = new ListNode(4,head); head = new ListNode(3,head); head = new ListNode(2,head); head = new ListNode(1,head); List..

    [프로젝트 환경설정] 04. 빌드하고 실행하기

    콘솔로 이동 ./gradlew build cd build/libs java -jar hello-spring-0.0.1-SNAPSHOT.jar 실행 확인 윈도우 사용자를 위한 팁 콘솔로 이동 명령 프롬프트(cmd)로 이동 ./gradlew gradlew.bat 를 실행하면 됩니다. 명령 프롬프트에서 gradlew.bat 를 실행하려면 gradlew 하고 엔터를 치면 됩니다. gradlew build 폴더 목록 확인 ls -> dir 윈도우에서 Git bash 터미널 사용하기 링크: https://www.inflearn.com/questions/53961 [[ 강의 시청 Tip ]] 윈도우라서 맥의 iTerm이 없는데 어떡하나!? - 인프런 | 질문 & 답변 `윈도우라서 맥의 iTerm이 없는데 어떡하나!?..

    [프로젝트 환경설정] 03. View 환경설정

    View 환경설정 Welcome Page 만들기 resources/static/index.html Hello hello 스프링 부트가 제공하는 Welcome Page 기능 static/index.html 을 올려두면 Welcome page 기능을 제공한다. https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-bootfeatures.html#boot-features-spring-mvc-welcome-page thymeleaf 템플릿 엔진 thymeleaf 공식 사이트: https://www.thymeleaf.org/ 스프링 공식 튜토리얼: https://spring.io/guides/gs/serving-web-content..