This is a commonly used pattern.

# Problem 0: 67. Add Binary

LeetCode #67. Add Binary

Given two binary strings, return their sum (also a binary string).

The input strings are both non-empty and contains only characters 1 or 0.

Example 1:

Input: a = “11”, b = "1"

Output: “100”

1 | class Solution { |

# Problem 1: Base 7

Given an integer, return its base 7 string representation.

Example 1:

Input: 100

Output: “202”

1 | class Solution { |

# Problem 2: 231. Power of Two

LeetCode #231. Power of Two

Given an integer, write a function to determine if it is a power of two.

Example 1:

Input: 1

Output: true

Explanation: 2^0 = 1

1 | class Solution { |

## 326. Power of Three

LeetCode 326. Power of Three

Given an integer, write a function to determine if it is a power of three.

Example 1:

Input: 27

Output: true

1 | class Solution { |

## 342. Power of Four

Given an integer (signed 32 bits), write a function to check whether it is a power of 4.

Example 1:

Input: 16

Output: true

1 | class Solution { |

# Problem 3: Add Two Numbers

LeetCode #2. Add Two Numbers

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 contain 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.

Example:

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)

Output: 7 -> 0 -> 8

Explanation: 342 + 465 = 807.

1 | /** |

# Problem 4: Add Strings

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.

Note:

The length of both num1 and num2 is < 5100.

Both num1 and num2 contains only digits 0-9.

Both num1 and num2 does not contain any leading zero.

You must not use any built-in BigInteger library or convert the inputs to integer directly.

1 | class Solution { |