본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

Jimin's Programming (194)
Cut the sticks

간단하게는 minimum value 로 each index를 subtract할 수 있는 갯수를 구하는 문제. Solution 1 in Javascript const arr = [5, 3, 2, 2, 2, 8] function cutTheSticks(arr) { //sort the array let sorted = arr.sort(); //set index[0] to a min let min = sorted[0]; console.log(sorted.length); for (let i = 0; i min) { min = sorted[i]; //change min to next shortest min console.log(sorted.le..

Algorithms 2020. 12. 18. 17:39
Equalize the Array

주어진 array 에서 최대로 중복되는 index를 제외한 나머지 index의 수를 구하는 문제 solution 1. 중복을 허용하지 않는 hashMap 을 선언. 2. 주어진 arr를 hashMap안에 넣으면서 중복되는 값이 있으면 value의 값이 1씩 증가하게 한다. 3. maximum value의 수를 찾는다. 4. 전체 array길이에서 찾아낸 maximum value를 return한다. Solution 1 -object를 이용하는 traditional way 말고 built-in function 인 Map을 이용하는 방식. function equalizeArray(arr) { //let arrObj = {}; //initialize object which is for hashmap. //but..

Algorithms 2020. 12. 11. 00:10
Invert Binary Tree

Binary Tree(이진트리) 의 node와 그 node의 children을 invert 하는 문제. node뿐 아니라 그 밑에 속해있는 자식들까지 swipe해야하기때문에 recursive function(재귀함수)을 사용해야한다. Solution 1 var invertTree = function(root) { //재귀의 정지값->root가 있을때 까지. if(root){ swap(root); //swipe children invertTree(root.left); //subtree의 children에게도 같은 process적용을 위해 recursive invertTree(root.right); } return root; }; var swap = function(root){ let left = root...

Algorithms 2020. 11. 30. 22:51
delete git repository

기존의 git을 삭제 후 다시 설정하는 법. 잘못 생성한 폴더로 가서 .git 폴더 전체 삭제 rm -rf .git/ 원하는 폴더로 이동 후 git init git add -A git commit -m "commit message" USERNAME@github.com/USERNAME/REPOSITORY_NAME.git git push -u origin master git add -A 를 하니 에러나던게 사라지고 잘 push됨. 만약에 git repository의 상위 폴더로 옮기고 싶을 경우. 전체 폴더를 복사해서 상위로 옮기는 방법을 사용!

Programming 2020. 11. 27. 23:10
Sequence Equation

Solution in Javascript const p = [4, 2, 5, 1, 3]; function permutationEquation(p) { const arr=[]; for (let i = 1; i

Algorithms 2020. 10. 30. 15:20
Viral Advertising

Solution in Javascript const n = 3; function viralAdvertising(n) { let k = 5; let j = 0; let sum = 0; for(let i = 0; i < n; i++){ j = Math.floor(k/2); k = j * 3; sum+=j; } console.log(sum); } viralAdvertising(n); *Use Math.floor() to get quotient. Reference www.hackerrank.com/challenges/strange-advertising/problem

Algorithms 2020. 10. 22. 19:31
이전 1 2 3 4 5 6 7 8 ··· 33 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • easy javascript algorithm
  • string class in java
  • ... in Javascript
  • rest parameter
  • algorithm
  • Object type casting
  • 프로그래머스
  • repeat()
  • code refactoring
  • easy algorithm
  • java
  • Javascript Algorithm
  • hackerrank solution
  • compareTo()
  • hackerrank
  • javascript
  • 프로그래머스 알고리즘
  • C++
  • spring boot application
  • hackerrank javascript
  • HashMap
  • 프로그래머스 알고리즘문제
  • 알고리즘
  • substring()
  • equals()
  • hackerrank javascript solution
  • math.abs
  • Collection Framework
  • HackerRank Algorithm
  • math.max
more
«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바