분류 전체보기
-
CORS 이해하기 및 해결방법Frontend/Javascript 2022. 12. 21. 20:48
CORS Cross-Origin Resource Sharing 여기서 출처(Origin)란, URL 구조에서 Protocal, Host, Port를 합친 것을 말한다. https://tistory.com/ 를 기준으로 Protocal은 'https//' , Host는 'tistory.com' , Port는 https의 번호인 443을 나타낸다. 동일 출처 정책을 지키면 외부 리소스를 가져오지 못하지만 XSS나 XSRF 등의 보안 취약점을 노린 공격을 방어할 수 있다. Same origin 정책과 cross origin 정책은 아래와 같다. - Same origin 정책 Client와 Server가 동일한 IP주소에서 동작하고 있다면 별다른 제약없이 서로 주고받을 수 있다. - Cross origin 정책..
-
3. Longest Substring Without Repeating Characters javaLeetCode_Study_Plan/Algorithm 2022. 12. 21. 11:24
https://leetcode.com/problems/longest-substring-without-repeating-characters/ 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 Queue를 이용한 풀이 class Solution { public static int lengthOfLongestSubstring(String s) { Queue q = new LinkedL..
-
567. Permutation in String javaLeetCode_Study_Plan/Algorithm 2022. 12. 21. 11:08
https://leetcode.com/problems/permutation-in-string/ Permutation in String - 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 class Solution { public boolean checkInclusion(String s1, String s2) { s1 = sort(s1); for (int i = 0; i < s2.length()-s1.length()+1; i++) { if (s1.equals(sor..
-
🎵 19. Remove Nth Node From End of List javaLeetCode_Study_Plan/Algorithm 2022. 12. 21. 00:42
https://leetcode.com/problems/remove-nth-node-from-end-of-list/ Remove Nth Node From End of List - 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 새로운 ListNode를 생성해도 head 이후의 next까지만 연결해놓고 return을 하기에 의도한 값이 아님. 추가 해결 필요 /** * Definition for singly-linked list. * public class ListN..
-
876. Middle of the Linked List javaLeetCode_Study_Plan/Algorithm 2022. 12. 21. 00:06
https://leetcode.com/problems/middle-of-the-linked-list/ Middle of the Linked List - 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 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; ..
-
🎵 557. Reverse Words in a String III javaLeetCode_Study_Plan/Algorithm 2022. 12. 20. 23:47
https://leetcode.com/problems/reverse-words-in-a-string-iii/ Reverse Words in a String III - 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 class Solution { public String reverseWords(String s) { String[] strs = s.split(" "); StringBuffer sb = new StringBuffer(); for(String str: s..
-
344. Reverse String javaLeetCode_Study_Plan/Algorithm 2022. 12. 20. 23:39
https://leetcode.com/problems/reverse-string/ Reverse String - 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 # 투포인터를 이용한 스와핑 class Solution { public void reverseString(char[] s) { int left = 0, right = s.length-1; while (left < right) { char temp = s[right]; s[right] = s[left]; s..
-
167. Two Sum II - Input Array Is Sorted javaLeetCode_Study_Plan/Algorithm 2022. 12. 20. 23:30
https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Two Sum II - Input Array Is Sorted - 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 class Solution { public int[] twoSum(int[] numbers, int target) { int[] ans = new int[2]; for (int i = 0; i < numbers.length; i++) { ..