๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.61K photos
3 videos
95 files
10.6K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
// Search a 2D Matrix II
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int n=matrix.size();
int m=matrix[0].size();
int i=0,j=m-1;
while(i<n and j>0){
if(matrix[i][j]==target){
return true;
}else if(matrix[i][j]>target){
j--;
}else{
i++;
}
}
return false;

}
};

//C++โœ…
General tips

Always validate input first. Check for inputs that are invalid, empty, negative, or different. Never assume you are given the valid parameters. Alternatively, clarify with the interviewer whether you can assume valid input (usually yes), which can save you time from writing code that does input validation.

Are there any time and space complexities requirements or constraints?

Check for off-by-one errors.

In languages where there are no automatic type coercion, check that concatenation of values are of the same type: int,str, and list.

After you finish your code, use a few example inputs to test your solution.

Is the algorithm supposed to run multiple times, perhaps on a web server? If yes, the input can likely be pre-processed to improve the efficiency in each API call.

Use a mix of functional and imperative programming paradigms:

๐Ÿ”น Write pure functions as often as possible.
๐Ÿ”น Use pure functions because they are easier to reason with and can help reduce bugs in your implementation.
๐Ÿ”น Avoid mutating the parameters passed into your function, especially if they are passed by reference, unless you are sure of what you are doing.
๐Ÿ”น Achieve a balance between accuracy and efficiency. Use the right amount of functional and imperative code where appropriate. Functional programming is usually expensive in terms of space complexity because of non-mutation and the repeated allocation of new objects. On the other hand, imperative code is faster because you operate on existing objects.
๐Ÿ”น Avoid relying on mutating global variables. Global variables introduce state.
๐Ÿ”น Make sure that you do not accidentally mutate global variables, especially if you have to rely on them.
๐Ÿ˜ฑ1
โ—๏ธGreat news for Programmersโ—๏ธ

We have created a separate channel to help you guys prepare for the coding interviews.
We will provide practice questions with solutions and study material to crack coding interviews

Join fast
๐Ÿ‘‡๐Ÿ‘‡
@crackingthecodinginterviews
๐Ÿ‘1
โ—๏ธVolvo Off Campus Drive 2022 | Freshers | Graduate Engineer | BE/ B.Tech | Bangaloreโ—๏ธ

๐Ÿ‘จโ€๐Ÿ’ป Job Role : Graduate Engineers
๐ŸŽ“ Qualification : B.E/B.Tech
๐ŸŽ– Batch : 2020, 2021 & 2022
๐Ÿ’ฐ CTC : 7.5 LPA-10 LPA

Apply Here

โœ… Share with your friends
๐Ÿ”” ZOHO Corp Off Campus Drive 2022 | B.E/B.Tech/Any Degree

* Job Role : Software Developer
* Qualification : B.E/B.Tech/Any Degree
* Batch : 2019, 2020, 2021, or 2022
* Salary : 4 LPA+

Apply Here

โœ… Share with your friends