## voteridcard.org is a SCAM

If you avail of any services from voteridcard.org, you are losing your personal info and privacy.

Skip to content ## voteridcard.org is a SCAM

## Python: Add Two Numbers – Linked List

## Python: Two Sum Problem

## Python: Stack with Push, Pop and seek Minimum Value with O(1)

## Python: Lowest Common Ancestor of a Binary Tree – Non Recursive

## Python: Lowest Common Ancestor of a Binary Search Tree

If you avail of any services from voteridcard.org, you are losing your personal info and privacy.

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 single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself.

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 return the first solution found, and assumes that no element appears twice. def twoSum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ index_map = {} for i

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 = [] self.minList = [] self.min = None def push(self, item): print("Push: ", item) self.items.append(item) if not self.min: self.min = item else: if item <= self.min: self.minList.append(self.min) self.min = item

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 __init__(self, val, left = None, right = None): self.val = val self.left = left self.right = right class Tree(): def __init__(self, root = None): self.root = root def

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 :type q: TreeNode :rtype: TreeNode """ if root is None or p is None or q is None: return None if p.val > q.val: temp = p p =