Professional Documents
Culture Documents
Stage 3 Micro Coding Challenge
Stage 3 Micro Coding Challenge
org/application/dashboard
https://apply.microverse.org/application/coding-challenges/
unlock
The Microverse Coding Challenges
The next step in your admission process is to test your coding skills with
our JavaScript Coding Challenges.
To get accepted into Microverse, you'll need to know basic HTML and
JavaScript. If you already have a little coding experience and are familiar
with HTML, then you can likely get by just fine. However, if you have no
coding experience, please join Microverse Level Up to learn the basics
with other applicants from across the world before moving forward.
BEFORE YOU START
1. You can submit the challenges as many times as you want with
absolutely no penalty.
2. If you have some experience with coding challenges, then you are
ready to try our challenges now. Feel free to use this JavaScript
Cheatsheet to help you with syntax.
3. If you are new to solving coding challenges, you might want to try
some practice challenges inside Microverse Level Up.
4. Set aside 4 hours of total focus to work on the Admissions
Challenges. If you have the time, you can move to the next page
now. Otherwise, we recommend scheduling time on your calendar
to come back later.
5. Please answer this quiz to self-assess your knowledge of web
technologies, GitHub, Git and pair programming basics. For the
questions that you miss, we will help you identify the content to
review. Don’t worry about your result because it will NOT be
considered in your application process.
I’m available for the next 4 hours and will submit my results once I’m
done.
Note: If you fail some of the tests, you can always go back to modify your
care how many times you submit your code in HackerRank, so feel free to
keep trying until you get it right. Even if you weren’t able to pass all the
test cases, you should still submit them so that we can recommend ways
Sign up, enter our contest, and complete the JavaScript challenges on
HackerRank using the button below. When you’re done, come back to
submit the challenges and continue with your application.
Sign up on HackerRank
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
function solveMeFirst(a, b) {
// Hint: Type return a+b below
return a + b;
}
function main() {
var a = parseInt(readLine());
var b = parseInt(readLine());;
var res = solveMeFirst(a, b);
console.log(res);
}
After submit: https://www.hackerrank.com/contests/microverse-fast-
track/challenges/solve-me-first/submissions/code/1350612095
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'gradingStudents' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts INTEGER_ARRAY grades as parameter.
*/
function gradingStudents(grades) {
// Write your code here
for(let i = 0; i < grades.length; i++){
if((grades[i] >= 38) && ((((grades[i] % 5) == 3) || ((grades[i] %
5) == 4)))){
grades[i] = grades[i] + (5 - (grades[i] % 5));
}
}
return grades;
}
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'sockMerchant' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER n
* 2. INTEGER_ARRAY ar
*/
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
const n = parseInt(readLine().trim(), 10);
ws.write(result + '\n');
ws.end();
}
https://www.hackerrank.com/contests/microverse-fast-track/challenges/
sock-merchant/submissions/code/1350607945
https://www.hackerrank.com/contests/microverse-fast-track/challenges
Referred this code: https://dev.to/hokagedemehin/counting-valleys-
hackerrank-solution-javascript-2cd8
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'countingValleys' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER steps
* 2. STRING path
*/
function countingValleys(steps, path) {
// Write your code here
let strArr = path.split('')
let count = 0
let result = 0
for(let i=0; i<steps; i++){
if(count == 0 && strArr[i].toLowerCase() == 'd'){
count -= 1
result += 1
} else if(strArr[i].toLowerCase() == 'd'){
count -= 1
} else {
count += 1
}
}
return result
}
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
ws.write(result + '\n');
ws.end();
}
After submit https://www.hackerrank.com/contests/microverse-fast-
track/challenges/counting-valleys/submissions/code/1350611989