n, generate all structurally unique BST’s (binary search trees) that store values
Write a program to find the node at which the intersection of two singly linked lists begins. If the two linked lists have no intersection at all, return null. The linked lists must retain their original structure after the function returns. You may assume there are no cycles anywhere in the entire linked structure.
n, how many structurally unique BSTs (binary search trees) that store values
Given an array contains N numbers of
0 .. N, find which number doesn’t exist in the array.
Implement a function to check if a linked list is a palindrome. Can you do it in O(n) time and O(1) space?
Given an integer array, sort it in ascending order. Use selection sort, bubble sort, insertion sort or any O(n2) algorithm.
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7. One is also considered an ugly number.
Factory is a design pattern in common usage. Implement a ShapeFactory that can generate correct shape. You can assume that we have only tree different shapes: Triangle, Square and Rectangle.