Python: Add Two Numbers – Linked List
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contains a… Read More »Python: Add Two Numbers – Linked List
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contains a… Read More »Python: Add Two Numbers – Linked List
Given an array of integers, return indices of the two numbers such that they add up to a specific target. The below python code will… Read More »Python: Two Sum Problem
Pyhton 3 code to implement a stack with push, pop and seekMin function with time complexity of O(1) class Stack: def __init__(self): self.items = []… Read More »Python: Stack with Push, Pop and seek Minimum Value with O(1)
Python 3 code to find the Lowest Common Ancestor of a Binary Tree This is a Non Recursive solution using DFS method. class Node(): def… Read More »Python: Lowest Common Ancestor of a Binary Tree – Non Recursive
Python 3 code to find the Lowest Common Ancestor of a Binary Search Tree def lowestCommonAncestor(root, p, q): """ :type root: TreeNode :type p: TreeNode… Read More »Python: Lowest Common Ancestor of a Binary Search Tree
Python program to rotate an array towards its right Inplace Method # Rotate Array def roateRight(arr, size, rotate_count): array_length = len(arr) if array_length <= 0:… Read More »Python: Array/List Rotation – Right