목록분류 전체보기
Step-by-Step
https://leetcode.com/problems/check-completeness-of-a-binary-tree/ Check Completeness of a Binary Tree - LeetCode Can you solve this real interview question? Check Completeness of a Binary Tree - Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree [http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees], every leetcode.com ※ 경우에 따라 체크해야 할..
https://leetcode.com/problems/merge-k-sorted-lists/ Merge k Sorted Lists - LeetCode Can you solve this real interview question? Merge k Sorted Lists - You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lis leetcode.com LinkedList 값 받아오면서 null값만 적절히 체크해주면 금방 풀리는 문제 L..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dRJ1jt/btr3ftESFkz/AwsxKttL215RRGAmKoknV1/img.jpg)
https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/description/ Convert Sorted List to Binary Search Tree - LeetCode Can you solve this real interview question? Convert Sorted List to Binary Search Tree - Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced binary search tree. Example 1: [https://assets.l leetco..
https://socket.io/ Socket.IO Reliable Rest assured! In case the WebSocket connection is not possible, it will fall back to HTTP long-polling. And if the connection is lost, the client will automatically try to reconnect. socket.io 간단한 정리 : [IT 기술] - HTTP vs WebSocket vs Socket.IO ㅠㅠ 왜 이걸 이제 공부한거지?? 너무 재밌다.. 양방향 통신! Socket.io 설치 npm install socket.io 소켓의 기본 기능 // 데이터 주기 socket.emit("이벤트명", ... );..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bGUphI/btr2Rh5AjV6/IcnAkKj1dDLYRJbPJCBokK/img.png)
Http vs WebSocket HTTP(HyperText Transfer Protocol)은 기본적으로 "Client의 요청 - Server의 응답" 방식으로 이루어져있다. 클라이언트의 요청이 있는 경우에만 서버가 응답으로 리소스를 전송한 후, 연결을 바로 끊는 일방향 통신 기법이다. 또한 서버는 클라이언트의 정보를 저장하지 않는 Stateless 속성을 지녔으며, 쿠키나 세션을 통해 Stateful하도록 만들 수는 있다. 하지만 클라이언트가 정보가 필요한 경우에만 요청하고 응답하는 방식은, 두 클라이언트 사이의 정보를 유지하면서 끊임없이 정보를 주고받는 실시간 및 양방향 통신에는 적합하지 않다. 만약 HTTP로 채팅이나 실시간 통신을 구현하게 된다면, 모든 클라이언트들이 다른 클라이언트로부터 온 메세..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/DQGYK/btr1Y7JS6wY/afzDAn7fBHZbKmMbUKAxM1/img.png)
1) Chat 기능 Home Template - Form 설정 (home.PUG) ul form input(type="text", placeholder="write a message", required) button Send 메세지를 보낼 Form & Button 구현 메세지 작성 후 버튼 누르면 BackEnd 로 전송 (App.js) function handleSubmit(event) { // 기본 동작 방지 event.preventDefault(); socket.send(input.value); input.value = ""; // 전송 후 공백으로 변경 } messageForm.addEventListener("submit", handleSubmit); 접속한 Socket 저장 (Server.js) ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/d4zJ1Y/btr1UtN8R4I/ksBzqiKwyUvCk7yqZ7bLoK/img.png)
Express로 App 생성 import express from "express"; const app = express(); App 기본 설정 (Server.js) - HTTP 방식 /* HTTP 방식 */ // views에 있는 pug 템플릿 보여줌 app.set("view engine","pug"); app.set("views", __dirname + "/views"); // root 경로로 들어가면 home을 보여줌 (-> ./views/home.pug) app.get("/", (req, res)=> res.render("home")); // public 경로로 들어가면 public 하위 경로의 JS 실행 (static으로 설정해야 보임) app.use("/public", express.static..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/c9Ww2B/btr16ku9Oud/pYpfkADBI6SoAKJA5TkLp1/img.jpg)
https://leetcode.com/problems/count-subarrays-with-fixed-bounds/description/ Count Subarrays With Fixed Bounds - LeetCode Can you solve this real interview question? Count Subarrays With Fixed Bounds - You are given an integer array nums and two integers minK and maxK. A fixed-bound subarray of nums is a subarray that satisfies the following conditions: * The minimum value in leetcode.com Hard 문..