Professional Documents
Culture Documents
FINAL Assignment
FINAL Assignment
FINAL Assignment
1.Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed
parentheses.
Code:
Output:
2. Rotate Image
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees
(clockwise). You have to rotate the image in-place, which means you have to modify the input
2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Code:
Output
Output:
4. Count Primes
Given an integer n, return the number of prime numbers that are strictly less than n.
Code:
Output:
THANK YOU