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

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)
  • 방명록

hackerrank javascript solution (2)
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
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
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • algorithm
  • java
  • easy algorithm
  • Object type casting
  • Collection Framework
  • math.abs
  • HackerRank Algorithm
  • hackerrank
  • Javascript Algorithm
  • 프로그래머스 알고리즘문제
  • HashMap
  • C++
  • repeat()
  • math.max
  • 알고리즘
  • 프로그래머스
  • string class in java
  • ... in Javascript
  • compareTo()
  • easy javascript algorithm
  • 프로그래머스 알고리즘
  • equals()
  • hackerrank javascript solution
  • spring boot application
  • substring()
  • hackerrank javascript
  • hackerrank solution
  • rest parameter
  • javascript
  • code refactoring
more
«   2025/06   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바