Javascript Algorithims

I am going to solve challenges of “Basic Algorithim Scripting” want to ask is it efficient way to google the challenge if I stuck, understand the concept and code then write my own code?

the best way would be to search the specific task you are stuck on
“how to convert a string to an array”
“how to copy an array”
“how to remove properties from an object”
“how to add elements to an array”
“how to sort an array”
“what map does”
“what filter does”
and so on

after searching these things, if you still have troubles you can pass to the Ask part, make sure the code in the editor is your last attempt, and use the “Ask for help” button

if you just find the solution to an algorithm, even if then you try to implement it on your own, try anyway a couple of weeks later without looking at the solution

@ieahleen How someone gets to this that what to do next to solve a code problem ?

means how we know the next step would be this "convert a string to an array” or "add elements to an array”. hope you get my point.


first you try to create pseudocode
pseudocode is writing down in your own way the problem in the littlest steps

the input is an array of boolean values, you need to count how many true and false are in there. return an array with the two numbers.

// create variable falseNumber
// create variable trueNumber
// for each element in the array
   // if the element is false, increase falseNumber
   // if the element is true, increase trueNumber
// return array with the two variables 

here you need to know

  • how to create a variable
  • how to do something for each element in the array
  • how to check the value of the elements
  • how to increase a variable
  • how to create an array
  • how to return the array

you can also notice that you can do things a little differences, like create the array at the beginning, instead of two variables, and increase or one or the other element in the array

if you get better with pseudocode it will be easier to solve algorithms in any language, even those you started learning just yesterday - it just requires a lot of googling

because now that I have pseudocode, I can just write the code to do each of those things below the comment