-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathroundOne.js
More file actions
82 lines (70 loc) · 1.58 KB
/
roundOne.js
File metadata and controls
82 lines (70 loc) · 1.58 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Lead with Zeroes
* @description: Returns the same array, but moves all zeroes in the array to the front.
* Do not return a new array. It must be the same array!
* Ex: leadZeroes([2,2,0,1,0]) => [0,0,2,2,1]
*
* @param {array} arr - An array of integers
*/
function leadZeroes(arr) {
}
/**
* Setter
* @description: Returns an array of unique numbers.
* Ex: setter([1,1,2,2,3,3]) => [1,2,3]
*
* @param {array} arr - An array of data
*/
function setter(arr) {
}
/**
* Is Prime
* @description: Return true if the given number is a prime number, false otherwise
* Ex: isPrime(3) => true
*
* Resources:
* https://en.wikipedia.org/wiki/Prime_number
* https://youtu.be/mIStB5X4U8M
* @param num
*/
function isPrime(num) {
}
/**
* Modulus
* @description: Write a function that returns the remainder form dividing 2 integers WITHOUT USING %
* Ex: modulus(7, 3) => 1
*
* @param dividend
* @param divisor
*/
function modulo(dividend, divisor) {
}
/**
* Next Five
* @description: Write a function that takes a number and returns the next
* multiple of 5
* Ex: nextFive(6) => 10
* nextFive(25) => 30
*
* @param num
*/
function nextFive(num) {
}
/**
* Object Sort
* @description: Write a function that takes an object and sorts it
* alphabetically by key. Keys will always be alphabets (a-z or A-Z).
* Ex: osort({z: 3, a: 1}) => {a: 1, z: 3}
*
* @param obj
*/
function osort(obj) {
}
module.exports = {
leadZeroes: leadZeroes,
setter: setter,
isPrime: isPrime,
modulo: modulo,
nextFive: nextFive,
osort: osort
};