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

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)
Angry Professor

Solution in Javascript I const k = 3; const a = [-1, -3, 4, 2]; function angryProfessor(k, a) { const p = a.filter(v => v < 1).length < k ? 'YES' : 'NO' return p; } angryProfessor(k, a); 1. To filter elements which are less than 1, use filter() 2. length() is used to get the number of the elements. for loop 와 if 를 사용하는 것보다 내장 함수들을 사용하자. Solution in Javascript II const k = 4; const a = [-1, -3, -..

Algorithms 2020. 10. 19. 18:49
Beautiful Days at the Movies

Solution in Javascript const i = 20; const j = 23; const k = 6; function beautifulDays(i, j, k) { let beautifulDay = 0; while(i

Algorithms 2020. 10. 18. 18:41
Migratory Birds

The solution in Javascript I (Failed in HackerRank) sort 를 이용. 순서대로 정렬해준 후에 동일한 값의 (last index - first index) + 1 (0부터 시작하니까) 해외 블로그 접근이 좋긴했지만 결과적으로 HackerRank에서는 fail. const arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 3, 4, 1] function migratoryBirds(arr) { let bird = 1; let max = bird; //bird 의 시작이 1이라는 것은 at least one bird id는 존재한다는 의미. 나중에 더 큰 값이오면 대체. let result = 0; arr.sort(); //1,1,1,2,2,3,3,3,4,4..

Algorithms 2020. 10. 1. 23:50
Utopian Tree

Solution in JavaScript const n = 5; function utopianTree(n) { let cycle = 1; let height = 1; while (cycle

Algorithms 2020. 10. 1. 21:16
Using bcrypt inside async

Example code app.post("/register", (req, res) => { User.findOne({username: req.body.username}, async(err, doc) => { if(err) throw err; if(doc) res.send('User already exist'); if(!doc){ const hashedPassword = await bcrypt.hash(req.body.password, 10); const newUser = new User({ username: req.body.username, password: hashedPassword, }); await newUser.save(); res.send('User Created') } }) }) bcrypt ..

Node.js 2020. 9. 25. 23:18
Electronics Shop

Solution I in Javascript const keyboards = [3, 1]; const drives = [5, 2, 8]; const b = 10; function getMoneySpent(keyboards, drives, b) { let valid = []; keyboards.forEach(k => drives.forEach(d => k + d //1. reduce: arrow function 이용 single value return. //2. max: 조건에 맞게 max value를 리턴. //3. map: 함수이용 each elements 변화시킨다. -> drives와 keyboards each elements 더하기. //4. 합한 값을 budget보다 작거나 같은 값으로 filt..

Algorithms 2020. 9. 25. 23:00
이전 1 ··· 3 4 5 6 7 8 9 ··· 33 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • spring boot application
  • rest parameter
  • equals()
  • HackerRank Algorithm
  • C++
  • 프로그래머스 알고리즘
  • java
  • HashMap
  • string class in java
  • repeat()
  • easy algorithm
  • hackerrank javascript
  • hackerrank
  • hackerrank solution
  • math.max
  • ... in Javascript
  • compareTo()
  • easy javascript algorithm
  • Javascript Algorithm
  • code refactoring
  • algorithm
  • Collection Framework
  • math.abs
  • javascript
  • 알고리즘
  • hackerrank javascript solution
  • 프로그래머스 알고리즘문제
  • Object type casting
  • 프로그래머스
  • substring()
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

티스토리툴바