- Prepare
- Data Structures
- Trees
- Swap Nodes [Algo]
- Discussions
Swap Nodes [Algo]
Swap Nodes [Algo]
+ 27 comments One of the most ambiguous question on HackerRank. I wish I could down vote the problem description.
+ 21 comments In python had to change recursion limit to work on the last two test inputs
import sys sys.setrecursionlimit(15000)
+ 0 comments The problem is not hard at all, but very poor description and badly structured input make it a lot harder than it should be. I would suggest some areas for clarification. Is i the line number? Or is it node index? It's actually both, and the right answer is that null node should not be indexed but line numbers go on. It's not immediately clear if K is applied to depth or height, because below for some reason letter h is used to represent the depth. Use of index in the input and other constrains literally enforce the use of array upon the user.
+ 2 comments Solved the problem but had to. 1. Create node object. 2. Create a breathFirst to read input. 3. Create a depthFirst to change height. 4. Create a Inorder to print.
Took 3 hours total. Is is listed as "Easy?" Is there an easier way than the apporche I did?
+ 0 comments The worst question I've read....
Sort 657 Discussions, By:
Please Login in order to post a comment