Java Collection Framework

OverviewA collections framework is a class library to handle groups of objects. It is present in java.util package. It allows us to store, retrieve, and update a group of objects.Collections framework

- Expand -

LeetCode 22: Generate Parentheses

Problem DescriptionGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.Example 1Input: n = 3 Output: ["((()))","(()())","(()

- Expand -

LeetCode 21: Merge Two Sorted Lists

Problem DescriptionYou are given the heads of two sorted linked lists list1 and list2.Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two

- Expand -

LeetCode 17: Letter Combinations of a Phone Number

Problem DescriptionGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.A mapping of digits to l

- Expand -

LeetCode 15: Sum

Problem DescriptionGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.Notice that the solution

- Expand -

LeetCode 11: Container With Most Water

Problem DescriptionYou are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).Find two lines that tog

- Expand -

LeetCode 5: Longest Palindromic Substring

Problem DescriptionGiven a string s, return the longest palindromic substring in s.Example 1Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid answer.Exa

- Expand -

LeetCode 4: Median of Two Sorted Arrays

Problem DescriptionGiven two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.The overall run time complexity should be O(log (m+n)).Example 1Inpu

- Expand -

LeetCode 1: Two Sum

Problem DescriptionGiven an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one soluti

- Expand -

Java Quick Cheatsheet

Java Data TypesPrimitive Data Typesbyteshortintlongfloat: ~6-7 decimal digitsdouble: 15 decimal digitschar: surrounded by single quotesbooleanNotes:End the value with an "f" for floats and "d" for dou

- Expand -