본문 바로가기

개발 공부

(82)
[LeetCode] 60. Can Place Flowers You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule and false otherwise. My answer is t..
[LeetCode] 374. Guess Number Higher or Lower 374. Guess Number Higher or Lower We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.You call a pre-defined API int guess(int num), which returns three possible results:-1: Your guess is higher than the number I picked ..
[LeetCode] 62. Unique Paths 62. Unique PathsThere is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.Given the two integers m and n, return the number of possible unique paths that the robot can take to reach the bottom-right cor..
Permute Practice def permute(txt, src): if src == len(txt): return ["".join(txt)] seen = set() result = [] for i in range(src, len(txt)): if txt[i] in seen: continue seen.add(txt[i]) if src!=i: txt[src], txt[i] = txt[i], txt[src] result.extend(permute(txt, src+1)) if src!=i: txt[src], txt[i] = txt[i], txt[src] return result result = permute(lits(digits), 0)  - Bas..
[LeetCode] 17. Letter Combinations of a Phone Number 17. Letter Combinations of a Phone NumberGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.  BacktrackingBacktracking is an algorithmic techniqe used for solving probl..
[LeetCode] 2390. Removing Stars From a String 2390 . Removing Stars From a String You are given a string s, which contains stars *.In one operation, you can:Choose a star in s.Remove the closest non-star character to its left, as well as remove the star itself.Return the string after all stars have been removed.Note:The input will be generated such that the operation is always possible.It can be shown that the resulting string will always b..
[LeetCode] 338. Counting Bits 435. Counting BitsGiven an integer n, return an array ans of length n +1 such that for each i (0   1. Problem UnderstandingThe problem asks us to count the number of 1s (set bits) in the binary representation of every integer from 0 to n. The result should be returned as an array where the value at index i represents the count of set bits in the binary representation of i. 2. Core Concepts' Bina..
[LeetCode] 435. Non-overlapping Intervals 435. Non-overlapping Intervals Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note that intervals which only touch at a point are non-overlapping. For example, [1, 2] and [2, 3] are non-overlapping.  1. 문제 상황주어진 구간에서 겹치는 구간을 최소화하려면 몇 개의 구간을 제거해야 하는지 묻는 문제.겹치지 않는..
웹브라우저 Javascript - 이벤트, 네트워크 통신, 활용 웹브라우저 Javascript (자바스크립트) 8. 문서의 기하학적 특성 8.1 문서의 기하학적 특성 Coding 9. 이벤트 9.1 이벤트 이벤트는 어떤 사건을 의미한다. 브라우저에서 사건이란 사용자가 클릭을 했을 때, 스크롤을 했을 때, 필드의 내용을 바꿨을 때와 같은 것을 의미한다. button 태그가 event target(event가 발생하는 대상) click이 event type. event가 발생할 때의 코드를 event handler라고 함 9.2 등록방법 & inline inline 방식은 이벤트를 이벤트 대상의 태그 속성으로 지정하는 것이다. getElementById는 한 개의 개체만 return한다. id 중복일 경우 return x 9.3 프로퍼티 리스너 이벤트가 실행된 맥락의 정..
웹브라우저 Javascript - Element, Node, Document, Text 객체 웹브라우저 Javascript (자바스크립트) 4. Element 객체 4.1 Element 객체 . html css JavaScript t는 HTMLLIElement이다. 모든 HTML 태그들을 대표하는, 공통으로 속성으로 갖고 있는 객체는 HTMLElement이다. (ex, HTMLElement.style은 css 속성을 관리함) HTMLElement는 Element를 상속받는다. Element는 엘리먼트를 추상화한 객체이다. DOM은 HTML만을 제어하기 위한 모델이 아니다. XML, SVG 등의 마크업 형태의 언어를 제어하기 위한 규격이므로, Element는 마크업 언어의 일반적인 규격에 대한 속성을 정의하고 있다. 구체적인 각각의 언어는 HTMLElement, SVGElement 같은 객체를 통..