From c284d94b667951852469d97839956a37bec270ce Mon Sep 17 00:00:00 2001 From: utsav Date: Fri, 25 Mar 2022 21:22:35 +0530 Subject: [PATCH 1/6] Fixed a typo where the commenting was wrong --- Bit-Manipulation/SetBit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index f7774dd54f..5c5984304e 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -7,7 +7,7 @@ * bit binary representations of the number and * returns a number after comparing each bit. * - * 0 | 0 -> 0 + * 0 | 0 -> 0 * 0 | 1 -> 1 * 1 | 0 -> 1 * 1 | 1 -> 1 @@ -20,7 +20,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR */ -/** +/* * @param {number} number * @param {number} bitPosition - zero based. * @return {number} From 19b9cb2e24bdc9011a6df1dbe74f7c3fbaf0f963 Mon Sep 17 00:00:00 2001 From: utsav Date: Sat, 26 Mar 2022 17:59:46 +0530 Subject: [PATCH 2/6] optimised code --- Maths/FindLcm.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 0d09a7affb..18723cba50 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -26,11 +26,7 @@ const findLcm = (num1, num2) => { let maxNum let lcm // Check to see whether num1 or num2 is larger. - if (num1 > num2) { - maxNum = num1 - } else { - maxNum = num2 - } + maxNum = Math.max(num1, num2) lcm = maxNum while (true) { From b7d7112ce5199f107e5cb6bfba21e3ec28733e60 Mon Sep 17 00:00:00 2001 From: utsav Date: Sat, 26 Mar 2022 18:19:16 +0530 Subject: [PATCH 3/6] fixed a sentence structure --- Maths/LeapYear.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/LeapYear.js b/Maths/LeapYear.js index 355d7fc96a..bddcea7afc 100644 --- a/Maths/LeapYear.js +++ b/Maths/LeapYear.js @@ -7,7 +7,7 @@ * The logic behind the leap year is- * 1. If the year is divisible by 400 then it is a leap year. * 2. If it is not divisible by 400 but divisible by 100 then it is not a leap year. - * 3. If the year is not divisible by 400 but not divisible by 100 and divisible by 4 then a leap year. + * 3. If the year is not divisible by both 400 and 100 but divisible by 4 then a leap year. * 4. Other cases except the describing ones are not a leap year. * * @param {number} year From 9e27d164548db99fbe606f0c83dd67e12e38ff92 Mon Sep 17 00:00:00 2001 From: utsav Date: Sun, 27 Mar 2022 12:26:26 +0530 Subject: [PATCH 4/6] changed the sentence structure --- Bit-Manipulation/SetBit.js | 2 +- Maths/FindLcm.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index 5c5984304e..0f414fb2a4 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -7,7 +7,7 @@ * bit binary representations of the number and * returns a number after comparing each bit. * - * 0 | 0 -> 0 + * 0 | 0 -> 0 * 0 | 1 -> 1 * 1 | 0 -> 1 * 1 | 1 -> 1 diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 18723cba50..66728bb822 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -31,7 +31,11 @@ const findLcm = (num1, num2) => { while (true) { if (lcm % num1 === 0 && lcm % num2 === 0) break - lcm += maxNum + if (num1 > num2) { + maxNum = num1 + } else { + maxNum = num2 + } } return lcm } From 26f3687c154141d86a276d66935daf09881e83b7 Mon Sep 17 00:00:00 2001 From: utsav Date: Sun, 27 Mar 2022 12:46:41 +0530 Subject: [PATCH 5/6] updated pull request --- Maths/FindLcm.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 66728bb822..0d09a7affb 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -26,16 +26,16 @@ const findLcm = (num1, num2) => { let maxNum let lcm // Check to see whether num1 or num2 is larger. - maxNum = Math.max(num1, num2) + if (num1 > num2) { + maxNum = num1 + } else { + maxNum = num2 + } lcm = maxNum while (true) { if (lcm % num1 === 0 && lcm % num2 === 0) break - if (num1 > num2) { - maxNum = num1 - } else { - maxNum = num2 - } + lcm += maxNum } return lcm } From ab1995acb7f041443b9904e2179442b79dcbd102 Mon Sep 17 00:00:00 2001 From: Utsav Meena <95152531+utsav0@users.noreply.github.com> Date: Sun, 27 Mar 2022 13:25:02 +0530 Subject: [PATCH 6/6] Update SetBit.js --- Bit-Manipulation/SetBit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index 0f414fb2a4..f7774dd54f 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -20,7 +20,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR */ -/* +/** * @param {number} number * @param {number} bitPosition - zero based. * @return {number}