LetsUpgrade / Algorithmic-Treasure

Many time, when an interview approaches, candidates start searching for different algorithms in different programming languages for practise. This project aims to build a website which will contain the codes along with the techniques and explanations so that it can be helpful for many
https://abhijit2505.github.io/Algorithmic-Treasure-Site/
MIT License
11 stars 13 forks source link

Basic Array Problems #1

Closed Abhijit2505 closed 4 years ago

Abhijit2505 commented 4 years ago

You can use any programming site like Leetcode, Codeforces etc to get two questions based on array which are of basic level. Only get two questions first. No need to get the answers or solve them for this issue.

Find two such questions on the array and post the link as a reply to this issue.

Deadline - 28th July 6.00PM

abhinavmaharana commented 4 years ago

1)Find and return the equilibrium index of an array. Equilibrium index of an array is an index i such that the sum of elements at indices less than i is equal to the sum of elements at indices greater than i. Element at index i is not included in either part. If more than one equilibrium index is present, you need to return the first one. And return -1 if no equilibrium index is present. Sample Input: 7 -7 1 5 2 -4 3 0 Sample Output: 3

2)An array is monotonic if it is either monotone increasing or monotone decreasing.

An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j].

Return true if and only if the given array A is monotonic.

Example 1:

Input: [1,2,2,3] Output: true

Example 2:

Input: [6,5,4,4] Output: true

Example 3:

Input: [1,3,2] Output: false

Example 4:

Input: [1,2,4,5] Output: true

Example 5:

Input: [1,1,1] Output: true

These are the question I will be solving next so I put this question here. question 1 link - https://codezen.codingninjas.com/practice/465/31/array-equilibrium-index question 2 link - https://leetcode.com/problems/monotonic-array/

Abhijit2505 commented 4 years ago

1)Find and return the equilibrium index of an array. Equilibrium index of an array is an index i such that the sum of elements at indices less than i is equal to the sum of elements at indices greater than i. Element at index i is not included in either part. If more than one equilibrium index is present, you need to return the first one. And return -1 if no equilibrium index is present. Sample Input: 7 -7 1 5 2 -4 3 0 Sample Output: 3

2)An array is monotonic if it is either monotone increasing or monotone decreasing.

An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j].

Return true if and only if the given array A is monotonic.

Example 1:

Input: [1,2,2,3] Output: true

Example 2:

Input: [6,5,4,4] Output: true

Example 3:

Input: [1,3,2] Output: false

Example 4:

Input: [1,2,4,5] Output: true

Example 5:

Input: [1,1,1] Output: true

These are the question I will be solving next so I put this question here. question 1 link - https://codezen.codingninjas.com/practice/465/31/array-equilibrium-index question 2 link - https://leetcode.com/problems/monotonic-array/

Please post only question links instead of the questions next time. Also, try to mention if it has been asked in any company interview.

Abhijit2505 commented 4 years ago

@abhinavmaharana , both the questions are nice. Good job. Now try to find if these questions were asked in any company interview before? If yes then mention the company names in a reply to this comment.

If they are not being asked in any company interview, then we will look into other possible questions based on array data structure.

Great 😃

priyagupta-js commented 4 years ago

question 1: https://practice.geeksforgeeks.org/problems/remove-duplicate-elements-from-sorted-array/1/?track=ppc-arrays&batchId=221 [Asked in: Morgan Stanley; Samsung; Wipro; Xome; Zoho.]

question2: https://practice.geeksforgeeks.org/problems/first-repeating-element4018/1/?track=ppc-arrays&batchId=221 [Asked in: Amazon ; Oracle ]

abhinavmaharana commented 4 years ago

@abhinavmaharana , both the questions are nice. Good job. Now try to find if these questions were asked in any company interview before? If yes then mention the company names in a reply to this comment.

If they are not being asked in any company interview, then we will look into other possible questions based on array data structure.

Great smiley

It is not asked in any company so should i solve it for getting the answer as the question is great and may in future it can be asked.

Abhijit2505 commented 4 years ago

@abhinavmaharana , both the questions are nice. Good job. Now try to find if these questions were asked in any company interview before? If yes then mention the company names in a reply to this comment. If they are not being asked in any company interview, then we will look into other possible questions based on array data structure. Great smiley

It is not asked in any company so should i solve it for getting the answer as the question is great and may in future it can be asked.

Let's try finding the questions which have been asked in an interview before. Don't be in a hurry to solve the problems, everyone will be given sufficient time to prepare the solution and the documentation.

so @abhinavmaharana, please find some questions that have already been asked in the interview in past, related to the array data structure.

Because there are thousands of problems available and we must focus on problems which are already been asked in the interviews.

Abhijit2505 commented 4 years ago

question 1: https://practice.geeksforgeeks.org/problems/remove-duplicate-elements-from-sorted-array/1/?track=ppc-arrays&batchId=221 [Asked in: Morgan Stanley; Samsung; Wipro; Xome; Zoho.]

question2: https://practice.geeksforgeeks.org/problems/first-repeating-element4018/1/?track=ppc-arrays&batchId=221 [Asked in: Amazon ; Oracle ]

These are awesome

AfraMP commented 4 years ago

Question 1: https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s4231/1 [ Asked in: Amazon, Adobe, Paytm, Ola, Qualcomm]

Question 2: https://practice.geeksforgeeks.org/problems/left-out-candies/0 [Asked in: Amazon]

Rsr0 commented 4 years ago

Q1).Max Sum Contiguous Subarray https://www.interviewbit.com/problems/max-sum-contiguous-subarray/ Asked in: Facebook Paypal Yahoo Microsoft LinkedIn Amazon Goldman Sachs

Q2).Pascal Triangle https://www.interviewbit.com/problems/pascal-triangle/ Asked in: Google Amazon

ashish11chawda commented 4 years ago
  1. https://www.interviewbit.com/problems/wave-array/ [ Asked in : Google, Adobe, Amazon ]

  2. https://www.interviewbit.com/problems/find-duplicate-in-array/ [Asked in: Amazon, VMWare, Riverbed]

abhinavmaharana commented 4 years ago

1.) https://www.interviewbit.com/problems/add-one-to-number/ [ Asked in : Google,Amazon ]

2.) https://www.interviewbit.com/problems/maximum-absolute-difference/ [ Asked in : Amazon ]

Basic Array question was asked in interviews also. if you don't like the first one then

3) https://www.interviewbit.com/problems/min-steps-in-infinite-grid/ [ Asked in : Directi ]

Himanshi2016 commented 4 years ago

Q1) https://www.interviewbit.com/problems/max-min-05542f2f-69aa-4253-9cc7-84eb7bf739c4/ (Asked in : Google)

Q2)https://www.geeksforgeeks.org/next-greater-element/ (Asked in : Amazon)

ishi0301 commented 4 years ago

Q1)https://www.interviewbit.com/problems/rotate-matrix/ ASKED IN- GOOGLE ,FB,AMAZON Q2)https://www.interviewbit.com/problems/first-missing-integer/ ASKED IN- Model N,InMobi,Amazon

MercyRabecal commented 4 years ago

Q1)https://practice.geeksforgeeks.org/problems/count-the-zeros/0 Asked in-Amazon,yahoo Q2)https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s4231/1 Asked in-Amazon,,Adobe,SAP,Microsoft,etc

chaitali0210 commented 4 years ago

1]https://practice.geeksforgeeks.org/problems/find-the-fine/0 Asked in - Microsoft

2]https://practice.geeksforgeeks.org/problems/convert-array-into-zig-zag-fashion/0 Asked in -Amazon ,Paytm