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
/** | |
* Title: Solution for Level Nodes Problem on HackerEarth | |
* Author: Manuel Figueroa (github.com/mfigueroa) | |
* | |
* Breadth First Search: https://www.hackerearth.com/practice/algorithms/graphs/breadth-first-search/tutorial/ | |
* | |
* Problem Summary | |
* You have been given a Tree consisting of N nodes. A tree is a fully-connected graph consisting of N nodes and N - 1 edges. | |
* The nodes in this tree are indexed from 1 to N. Consider node indexed 1 to be the root node of this tree. The root | |
* node lies at level one in the tree. You shall be given the tree and a single integer x. You need to find out the |
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://leetcode.com/problems/rotate-list/ | |
# Definition for singly-linked list. | |
# class ListNode(object): | |
# def __init__(self, val=0, next=None): | |
# self.val = val | |
# self.next = next | |
class Solution(object): | |
def rotateRight(self, head, k): | |
""" | |
:type head: ListNode |