Created
July 10, 2018 04:50
-
-
Save dosbol/6849481947914a18d7085f6e79b66eac to your computer and use it in GitHub Desktop.
draft solution(texting from smartphone)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://algoprog.ru/material/p50 | |
const iter = (first, second, n) => { | |
if(isEmpty(first)) return 'second' | |
if(isEmpty(second)) return 'first' | |
if(n === 1000000) return 'botva' | |
const firstCard = head(first) | |
const secondCard = head(second) | |
return iter(firstCard < secondCard ? headPoped(first) : tailPushed(first, secondCard, firstCard), firstCard > secondCard ? headPoped(second) : tailPushed(second, firstCard, secondCard), n+1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment