Skip to content

Instantly share code, notes, and snippets.

@Shubhra22
Last active October 24, 2020 18:27
Show Gist options
  • Save Shubhra22/3f1cc17a51b54449b046b5d6ca973f79 to your computer and use it in GitHub Desktop.
Save Shubhra22/3f1cc17a51b54449b046b5d6ca973f79 to your computer and use it in GitHub Desktop.
Arrays

Problem 1

How do you find the missing number in a given integer array of 1 to 10?

Problem 2

How do you find the duplicate number on a given integer array?

Problem 3

How do you find the largest and smallest number in an unsorted integer array?

Problem 4

How do you find all pairs of an integer array whose sum is equal to a given number?

Write a Java program to sum values of an array.
WWrite a Java program to sum values of each row of a 2d array.
Write a Java program to print the following grid
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - -
Write a Java program to find the second smallest element in an array.
Write a Java program to add two matrices of the same size
For example, if we have two metrices
1 2 3 . 1 2 3 . 2 4 6
2 3 5 + 1 2 3 = 3 5 8
3 2 4 2 0 1 . 5 2 5
1. Reverse a string using stack
2. Given an expression string exp , write a program to examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in exp.
Example:
Input: exp = “[()]{}{[()()]()}”
Output: Balanced
Input: exp = “[(])”
Output: Not Balanced
3. We are given a string having parenthesis like below
“( ((X)) (((Y))) )”
We need to find the maximum depth of balanced parenthesis, like 4 in above example. Since ‘Y’ is surrounded by 4 balanced parenthesis.
If parenthesis are unbalanced then return -1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment