DEV Community

Discussion on: Can you solve this interview problem?

Collapse
 
crimson589 profile image
crimson

I don't want to code but is it...

  1. Turn String back to array (JSON.parse)
  2. Join the array values together
  3. decode the value
  4. Check if it was decoded successfully and if the result was a valid URL
  5. If not, join the array in another sequence and repeat step 2

?

Can probably shorten it by always putting the string with an equal sign at the end and just looping the rest.

Collapse
 
0shuvo0 profile image
Shuvo

Yes but there might be multiple valid URL tho