전체 글
-
JPA Hibernate를 쓴다면 어노테이션으로 ON DELETE CASCADE 조건 추가하기SW 정글/회고록 2024. 11. 17. 16:39
게시글을 지우면 게시글의 댓글도 함께 지워져야 한다.SQL 스크립트에서 마지막 줄에 ON DELETE CASCADE; JPA를 사용할 때 엔터티에서 어노테이션 추가로도 해 줄 수 있다.Hibernate 를 쓸 경우 가능@OnDelete(action = OnDeleteAction.CASCADE) 나는 개설한 스터디룸에서 참여 중인 멤버나 해당 스터디룸만의 일정 등 다양한 테이블이 엮이므로 사용했다. @Schedulepackage com.jungle.studybbitback.domain.room.entity.schedule;import com.jungle.studybbitback.common.entity.ModifiedTimeEntity;import com.jungle.studybbitback.domai..
-
포트번호 없이 ip 만으로 접속카테고리 없음 2024. 11. 4. 14:59
기존에는 ip주소에 포트번호 8080까지 붙여줘야만 접속이 가능했다.이걸 간단히 생략하고 ip주소만으로 접속하는 방법에 대해 알아왔다. iptables 설정을 초기화 하고 원하는 포트번호(ex:8080)가 기본값인 80으로 redirection되게 해 주면 된다.$ sudo iptables -F -t nat$ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 접속이 잘 된다. 예전에 nginx로 해야하는 줄 알고 삽질했던 때가 생각난다.굉장히 간단했다.referencehttps://eng-sohee.tistory.com/105
-
[Sorting] 56. Merge IntervalsSW 정글/운영체제 2024. 10. 24. 00:13
https://leetcode.com/problems/merge-intervals/description/Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Example 1:Input: intervals = [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlap, merge..
-
[Two Pointer] 392. Is SubsequenceSW 정글/알고리즘 2024. 10. 23. 22:26
https://leetcode.com/contest/leetcode-weekly-contest-3/problems/is-subsequence/ Given two strings s and t, return true if s is a subsequence of t, or false otherwise.A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence ..
-
[stack] 20. Valid ParenthesesSW 정글/알고리즘 2024. 10. 23. 16:46
https://leetcode.com/problems/valid-parentheses/description/ Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets.Open brackets must be closed in the correct order.Every close bracket has a corresponding open bracket of the same type. Example 1:..
-
[String] 14. Longest Common Prefix / startswith() 함수SW 정글/알고리즘 2024. 10. 23. 15:34
https://leetcode.com/problems/longest-common-prefix/description/ Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "". Example 1:Input: strs = ["flower","flow","flight"]Output: "fl"Example 2:Input: strs = ["dog","racecar","car"]Output: ""Explanation: There is no common prefix among the input strings. Constra..
-
[String] 412. Fizz BuzzSW 정글/알고리즘 2024. 10. 23. 14:14
https://leetcode.com/problems/fizz-buzz/description/ Given an integer n, return a string array answer (1-indexed) where:answer[i] == "FizzBuzz" if i is divisible by 3 and 5.answer[i] == "Fizz" if i is divisible by 3.answer[i] == "Buzz" if i is divisible by 5.answer[i] == i (as a string) if none of the above conditions are true.더보기 1부터 n까지의 숫자를 순서대로 출력합니다.각 숫자에 대해 다음 규칙을 따릅니다:숫자가 3의 배수일 경우: "Fiz..
-
[math] 7. Reverse IntegerSW 정글/알고리즘 2024. 10. 23. 13:53
https://leetcode.com/problems/reverse-integer/description/ Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0.Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Example 1:Input: x = 123Output: 321Example 2:Input: x = -123Output: -321E..