Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6b45e73

Browse files
test: added test for some last solutions
1 parent 94665db commit 6b45e73

27 files changed

+136
-26
lines changed

‎js_solutions/0263_ugly_number.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @param {Number} num
55
* @returns {Boolean}
66
*/
7-
constisUgly= (num) => {
7+
exportdefault (num) => {
88
if (num === 0) return false;
99
const limits = [2, 3, 5];
1010
// Iterate through the limits and check if

‎js_solutions/0268_missing_number.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param {Array []} nums
66
* @returns {Number}
77
*/
8-
constmissingNumber= (nums) => {
8+
exportdefault (nums) => {
99
let result = 0;
1010
for (let i = 0; i < nums.length; i += 1) {
1111
result = result ^ i ^ nums[i];

‎js_solutions/0326_power_of_three.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @param {Number} num
55
* @returns {Boolean}
66
*/
7-
constisPowerOfThree= (num) => {
7+
exportdefault (num) => {
88
while (num > 1) {
99
num /= 3;
1010
}

‎js_solutions/0342_power_of_four.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
* num - 1 = 15 = 01111
1313
* num & (num - 1) = 10000 AND 01111 => 0 and 16 % 3 => 1
1414
*/
15-
constisPowerOfFour= (num) => (num & num - 1) === 0 && num % 3 === 1;
15+
exportdefault (num) => (num & num - 1) === 0 && num % 3 === 1;

‎js_solutions/0367_valid_perfect_square.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param {Number} num
66
* @returns {Boolean}
77
*/
8-
constvalidPerfectSquare= (num) => {
8+
exportdefault (num) => {
99
// Check square of div till reaching given num
1010
let div = 1;
1111
while (div * div < num) {

‎js_solutions/0421_maximum_xor_of_two_numbers_in_an_array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @param {Array []} nums
55
* @returns {Number}
66
*/
7-
constfindMaximumXOR= (nums) => {
7+
exportdefault (nums) => {
88
// To make algo work faster
99
const set = [...new Set(nums)];
1010
if (set.length === 1) return 0;

‎js_solutions/0451_sort_characters_by_frequency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param {String} str String to be sorted
66
* @returns {String}
77
*/
8-
constfrequencySort= (str) => {
8+
exportdefault (str) => {
99
// Find array of frequencies of chars in the string
1010
const frequency = str.split('')
1111
.reduce((acc, char) => {

‎js_solutions/0461_hamming_distance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @param {Number} y
77
* @returns {Number}
88
*/
9-
consthammingDistance= (x, y) => {
9+
exportdefault (x, y) => {
1010
const xor = x ^ y;
1111
let hammingDistance = 0;
1212
for (const bit of xor.toString(2)) {

‎js_solutions/1287_element_appearing_more_than_25_in_sorted_array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @param {Array []} nums
77
* @returns {Number}
88
*/
9-
constfindSpecialInteger= (nums) => {
9+
exportdefault (nums) => {
1010
// Find 25 %
1111
const quarter = Math.trunc(nums.length / 4);
1212
const frequency = {};

‎js_solutions/1523_count_odd_numbers_in_an_interval_range.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param {Number} high
66
* @returns {Number}
77
*/
8-
constcountOdds= (low, high) => {
8+
exportdefault (low, high) => {
99
let count = 0;
1010
for (let i = low; i <= high; i += 1) {
1111
count += i % 2 === 1 ? 1 : 0;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /