Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

### Coding Guidelines and Sample Codes

For all of the problems on InterviewBit, we do not require you to write a main function / Main class.

You are not required to read input, but instead use the arguments passed to your function. You are not required to print the desired values, but instead return the data as defined by the function signature.

Lets say you were given the problem of adding 2 number a and b.

```          Example:

a : 2
b : 3

Output : 5

```

The code will go like this :

CPP

```          int add(int a, int b) {
return a + b;
}

```

C

```          int add(int a, int b) {
return a + b;
}

```

Python

```          class Solution:
return a + b

```

Java

```        public class Solution {
public int add(int a, int b) {
return a + b;
}
}
```

For all of the problems of Bash on InterviewBit, incase you have to take input, please take it from file named 'input' (without quotes). Print your final output to console.

Lets say you were given the problem of adding two numbers which are in the first line of the file named 'input'

```          Example:

Input:
2 3

Output : 5

```

Bash

```         #!/bin/bash

a=\$(cat input| head -n 1 | awk '{print \$1}')
b=\$(cat input| head -n 1 | awk '{print \$2}')
echo \$((a+b))
```
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College/University Name
Job Title
Job Title
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Data Analyst
Data Engineer
Non Coder
Other
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Free Mock Assessment
Instructions from Interviewbit
Start Test
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College/University Name
Job Title
Job Title
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer