Skip to content

jsminna/mini-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm challenges in javascript

Instructions

  • Don't edit the index.html and test.js file
  • All codes should be written in the challenge.js file
  • Functions has already been created, don't add extra parameters or rename the function
  • Ensure you return the final output
  • Fork the repo
  • On your terminal, git clone https://github.com/your_username/mini-challenge/
  • Work on the challenge, and make a pull request
  • Open index.html in your terminal to run the test cases

Challenge 1: find longest word in a sentence

In the challenge.js file, a function findLongestWordLength has been created.

Sample input1: findLongestWordLength("Javascript is a fun language")
Expected output1: "Javascript"

Sample input2: findLongestWordLength("solving problem is a good way to learn")
Expected output2: "solving" (It returns the first element if more than one element have the same length)

Challenge 2: Get the largest elements in an array as an array

Input format: An multidimensional array (an array of arrays e.g [[1, 2], [2, 3], [3, 4]]). You're expected to return an array consisting of the largest number from each provided sub-array In the challenge.js file, a function findLargestOfArrays has been created, your implementation should be in the function

Sample input1: findLargestOfArrays([[1, 2], [2, 3], [3, 4]])
Expected output1: [2, 3, 4]

Sample input2: findLargestOfArrays([[1, 2, 3, 4], [5, 18, 0, 12], [3, 5, 12, 5], [28, 9, 2, 34]])
Expected output2: [4, 18, 12, 34]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •