Returning multiple values from a recursive function
I have this problem where I have to convert a decimal number to binary and then store the bits in a linked list where the head node is the most significant bit and the last node is the least significant bit. Solving the problem itself is actually easy as you only need to keep taking the modulo of 2 recursively and add the result in the list until the decimal number becomes 0. Where I'm stuck is that I have to write the function such that it returns a pair of number, (whether an array or a list) of the most significant bit and the last significant bit. i.e: Inputting 14 in the function would re
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.