# C++ Solution

## Contains Duplicate II LeetCode Solution

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i – j) <= k.

## Happy Number LeetCode Solution

Write an algorithm to determine if a number n is happy. Return true if n is a happy number, and false if not.

## House Robber LeetCode Solution

Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.

## Reverse Bits LeetCode Solution

Reverse bits of a given 32 bits unsigned integer.

## Intersection of Two Linked Lists LeetCode Solution

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.

## Single Number LeetCode Solution

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.

## Convert Sorted List to Binary Search Tree LeetCode Solution

Given the head of a singly linked list where elements are sorted in ascending order, convert it to a  height-balanced binary search tree.

## Text Justification LeetCode Solution

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully justified.

## Merge k Sorted Lists LeetCode Solution

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.

## Valid Parentheses LeetCode Solution

Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid.

## Regular Expression Matching LeetCode Solution

Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where ‘.’ Matches any single character and ‘*’ Matches zero or more of the preceding element.

## Nim Game LeetCode Solution

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

Given an integer num, repeatedly add all its digits until the result has only one digit, and return it.

## Delete Node in a Linked List LeetCode Solution

There is a singly-linked list head and we want to delete a node node in it. Delete the given node

## Reverse Linked List LeetCode Solution

Given the head of a singly linked list, reverse the list, and return the reversed list.

Scroll to Top