Category: algorithms
Given two binary strings, return their sum (also a binary string). For example, a = “11” b = “1” Return “100”. It looks easy however may not seem so: …
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assume that the version strings …
Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number …
A Binary Search Tree (BST) is a binary tree that satisfies the following requirements: The value of a parent node is bigger than all values of its left sub …
A Singly Linked List is a one-direction List that uses a pointer to connect between Nodes. To reverse a linked list, you need to re-connect the directions, for example: …