Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Math.pow(a, b)
Hi, you can wrap your code by using the markdown syntax which will make your code more readable.
I just implement this funtionality with recursion:
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]()([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]())
I took a different approach to this. If remixing the code is what we're doing, I just wrote it in a different way.
But here's mine, it works in the console.
const expo = (a, b) => {
let raise = Math.pow(a, b);
return raise;
};
expo(2, 4);
thanks
nice
Hi Clair. If the original problem is from "a company's coding assessment", then maybe they also want to see what you do with an inadequately stated requirements specification, which is a very common real-world situation!
If they can't or won't clarify, then I would simply state your assumptions and provide your solution that passes.
Otherwise if you have more automated tests you could also try some different assumptions (eg there must be as many '-' as there are '.') and modify your code.
BTW, you really don't need a 'stack' in your code since you only need to keep track of how many '.' you have seen -- so a simple int is enough.
Good luck!
That's the question I got from a company's coding assessment, I agree, there is some information doesn't clarified, and I try what you said in my code and try that test again , but stll left 3 test cases couldn't pass, unfortunately, all the weighted test cases are hiden.
The description of "input1" and "input2" seems somewhat C language centric, and input1 is quite redundant as can be seen in your initial code -- it is never referenced. Better to just describe the single input as being the "Sequence of strings, each representing a new message in the set" and leave it to the language specific variant whether that is an array, a list, a length + a pointer, or whatever.
Another example with extra dashes might clarify that unmatched '-' are ok, just no unmatched '.'. Assuming that is the case, then:
".---.-" is OK (extra dashes but every dot still has a corresponding dash)
".--..-.-" is not OK (extra dashes, but not enough dashes after the 2nd and 3rd dots)