In this ever-evolving digital landscape, the ability to code is not just a valuable asset but a gateway to creative expression and innovation. This brief guide will outline practical steps and essential principles to guide aspiring learners on their path to mastering the art of coding.
1. Introduction, to Basic Syntax. Hello World:
Lets learn the basic syntax of hello world program in different programming languages such as C, C++, Java and Python
C++
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
C
#include<stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!\n");
}
}
Python
JavaScript
// JavaScript code to print "Hello, World!"
function main() {
console.log("Hello, World!");
}
// Calling the main function to execute the code
main();
2. Understanding Data Types:
Data types are crucial, in specifying the type of data that can be stored within a variable. Common data types encompass integers, floating point numbers, characters and various others.
C++
int num = 10;
float pi = 3.14;
char grade = 'A';
C
int num = 10;
float pi = 3.14;
char grade = 'A';
Java
int num = 10;
float pi = 3.14;
char grade = 'A';
Python
num = 10
pi = 3.14
grade = 'A'
JavaScript
// Declaring variables in JavaScript
let num = 10; // Integer variable
let pi = 3.14; // Floating-point variable
let grade = 'A'; // Character variable (represented as a string)
// Printing the values
console.log("num:", num);
console.log("pi:", pi);
console.log("grade:", grade);
3. Variables and Constants:
In programming variables act as containers for data that can be altered during the execution of a program. Conversely constants store data that remains unchanged throughout its course.
- Declaration and Initialization Process:
C++
int num; // Declaration
num = 10; // Initialization
C
int num; // Declaration
num = 10; // Initialization
Java
int num; // Declaration
num = 10; // Initialization
Python
num = 10 # Declaration and Initialization
- Access Values stored in Variables and Constants:
Now lets see how we can access the values stored in variables and constants in different programming languages.
C++
std::cout << "Value of num: " << num << std::endl;
C
printf("Value of num: %d\n", num);
Java
System.out.println("Value of num: " + num);
Python
print("Value of num:", num)
4. Keywords:
Keywords are reserved words within a programming language that hold predefined meanings. It's basically important to note that they cannot be used as names or identifiers.
C++
#include <iostream>
int main() {
int y = 8; // 'int' is a keyword for defining an integer variable
return 0;
}
C
#include<stdio.h>
int main() {
int x = 5; // 'int' is a keyword indicating the variable type
return 0;
}
Java
public class GfgClass {
public static void main(String[] args) {
int z = 12; // 'int' is a keyword indicating the variable type
}
}
Python
def gfgKeyword():
pass # 'def' is a keyword used to define a function
JavaScript
// JavaScript doesn't require explicit data type declaration
// so there's no need to specify 'int' for variable declaration
// Define a variable 'y' and assign the value 8 to it
let y = 8;
// There's no need for a return statement in JavaScript for this case
// as it is not a required
Here, in the above code we can see there are some reserved keywords that have some already defined meaning such as int, return in C, C++ and Java and def and if..else in python.
5. Operators:
Operators are tools for performing operations on variables and values within code.
Arithmetic operators facilitate tasks, like addition subtraction, multiplication and division.
C++
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
C
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
Java
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
Python
sum = a + b
difference = a - b
product = a * b
quotient = a / b
remainder = a % b
JavaScript
let a, b;
let sum = a + b;
let difference = a - b;
let product = a * b;
let quotient = a / b;
let remainder = a % b;
Relational Operators:
Relational operators compare values and return a boolean result.
C++
#include <iostream>
int main() {
int a = 10;
int b = 20;
if (a == b) {
// equal
std::cout << "a is equal to b" << std::endl;
}
if (a != b) {
// not equal
std::cout << "a is not equal to b" << std::endl;
}
if (a < b) {
// less than
std::cout << "a is less than b" << std::endl;
}
if (a > b) {
// greater than
std::cout << "a is greater than b" << std::endl;
}
if (a <= b) {
// less than or equal
std::cout << "a is less than or equal to b" << std::endl;
}
if (a >= b) {
// greater than or equal
std::cout << "a is greater than or equal to b" << std::endl;
}
return 0;
}
C
#include <stdio.h>
int main() {
int a = 10;
int b = 20;
if (a == b) {
// equal
printf("a is equal to b\n");
}
if (a != b) {
// not equal
printf("a is not equal to b\n");
}
if (a < b) {
// less than
printf("a is less than b\n");
}
if (a > b) {
// greater than
printf("a is greater than b\n");
}
if (a <= b) {
// less than or equal
printf("a is less than or equal to b\n");
}
if (a >= b) {
// greater than or equal
printf("a is greater than or equal to b\n");
}
return 0;
}
Java
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 20;
if (a == b) {
// equal
System.out.println("a is equal to b");
}
if (a != b) {
// not equal
System.out.println("a is not equal to b");
}
if (a < b) {
// less than
System.out.println("a is less than b");
}
if (a > b) {
// greater than
System.out.println("a is greater than b");
}
if (a <= b) {
// less than or equal
System.out.println("a is less than or equal to b");
}
if (a >= b) {
// greater than or equal
System.out.println("a is greater than or equal to b");
}
}
}
Python
a = 10
b = 20
if a == b:
# equal
print('a is equal to b')
if a != b:
# not equal
print('a is not equal to b')
if a < b:
# less than
print('a is less than b')
if a > b:
# greater than
print('a is greater than b')
if a <= b:
# less than or equal
print('a is less than or equal to b')
if a >= b:
# greater than or equal
print('a is greater than or equal to b')
JavaScript
let a = 10;
let b = 20;
if (a == b) {
// equal
console.log('a is equal to b');
}
if (a != b) {
// not equal
console.log('a is not equal to b');
}
if (a < b) {
// less than
console.log('a is less than b');
}
if (a > b) {
// greater than
console.log('a is greater than b');
}
if (a <= b) {
// less than or equal
console.log('a is less than or equal to b');
}
if (a >= b) {
// greater than or equal
console.log('a is greater than or equal to b');
}
Outputa is not equal to b
a is less than b
a is less than or equal to b
Logical Operators:
Logical operators perform logical operations on boolean values.
C++
if (condition1 && condition2) {
// logical AND
}
if (condition1 || condition2) {
// logical OR
}
if (!condition) {
// logical NOT
}
C
if (condition1 && condition2) {
// logical AND
}
if (condition1 || condition2) {
// logical OR
}
if (!condition) {
// logical NOT
}
Java
if (condition1 && condition2) {
// logical AND
}
if (condition1 || condition2) {
// logical OR
}
if (!condition) {
// logical NOT
}
Python
if condition1 and condition2:
# logical AND
if condition1 or condition2:
# logical OR
if not condition:
# logical NOT
JavaScript
if (condition1 && condition2) {
// logical AND: Executes if both condition1 and condition2 are true
}
if (condition1 || condition2) {
// logical OR: Executes if either condition1 or condition2 (or both) are true
}
if (!condition) {
// logical NOT: Executes if condition is false
}
Unary, Binary, and Ternary Operators:
Unary operators operate on a single operand, binary operators on two, and ternary operators on three.
C++
int unary = -a; // unary minus
int binary = a + b; // binary plus
int ternary = (a > b) ? a : b; // ternary conditional
C
int unary = -a; // unary minus
int binary = a + b; // binary plus
int ternary = (a > b) ? a : b; // ternary conditional
Java
int unary = -a; // unary minus
int binary = a + b; // binary plus
int ternary = (a > b) ? a : b; // ternary conditional
Python
unary = -a # unary minus
binary = a + b # binary plus
ternary = a if a > b else b # ternary conditional
6. Decision Making statements:
Decision statements are used to control the flow of a program based on conditions.
If...else: The if...else Statement enables the execution of different blocks of code depending on a condition.
C++
if (condition) {
// code to execute if condition is true
} else {
// code to execute if condition is false
}
C
if (condition) {
// code to execute if condition is true
} else {
// code to execute if condition is false
}
Java
if (condition) {
// code to execute if condition is true
} else {
// code to execute if condition is false
}
Python
if condition:
# code to execute if condition is true
else:
# code to execute if condition is false
if...else if... : The if...else if...else statement allows checking multiple conditions one, after another.
C++
if (condition1) {
// code to execute if condition1 is true
} else if (condition2) {
// code to execute if condition2 is true
} else {
// code to execute if all conditions are false
}
C
if (condition1) {
// code to execute if condition1 is true
} else if (condition2) {
// code to execute if condition2 is true
} else {
// code to execute if all conditions are false
}
Java
if (condition1) {
// code to execute if condition1 is true
} else if (condition2) {
// code to execute if condition2 is true
} else {
// code to execute if all conditions are false
}
Python
if condition1:
# code to execute if condition1 is true
elif condition2:
# code to execute if condition2 is true
else:
# code to execute if all conditions are false
JavaScript
let condition1 = true;
let condition2 = false;
if (condition1) {
console.log("Condition 1 is true.");
} else if (condition2) {
console.log("Condition 2 is true.");
} else {
console.log("All conditions are false.");
}
Switch Statements: The switch statement is utilized to create branches based on the value of an expression.
C++
switch (expression) {
case value1:
// code block
break;
case value2:
// code block
break;
default:
// code block
}
C
switch (expression) {
case value1:
// code block
break;
case value2:
// code block
break;
default:
// code block
}
Java
switch (expression) {
case value1:
// code block
break;
case value2:
// code block
break;
default:
// code block
}
Python
def switch(someCase):
if case1:
// code block
elif case2:
// code block
elif case3:
// code block
else:
// code block
JavaScript
switch (expression) {
case value1:
// This block of code is executed if the expression equals value1
break;
case value2:
// This block of code is executed if the expression equals value2
break;
default:
// This block of code is executed if the expression doesn't match any of the cases
}
7. Loops:
Entry Condition Loop:
Loops that are controlled by an entry condition execute the code block long as the condition remains true.
C++
#include <iostream>
int main() {
int i = 0;
while (i < 5) {
std::cout << i << " ";
i++;
}
return 0;
}
C
#include<stdio.h>
int main() {
int i = 0;
while (i < 5) {
printf("%d", i);
i++;
}
return 0;
}
Java
public class EntryConditionLoop {
public static void main(String[] args) {
int i = 0;
while (i < 5) {
System.out.print(i + " ");
i++;
}
}
}
Python
i = 0
while i < 5:
print i,
i += 1
JavaScript
/ Initialize a variable i with the value 0.
let i = 0;
// Use a while loop to iterate while i is less than 5.
while (i < 5) {
// Print the current value of i to the console.
console.log(i + " ");
// Increment the value of i by 1.
i++;
}
Exit Condition Loop:
Loops that are controlled by an exit condition execute the code block until the condition becomes false.
C++
#include <iostream>
int main() {
int i = 0;
do {
std::cout << i << " ";
i++;
} while (i < 5);
return 0;
}
C
#include <stdio.h>
int main() {
int i = 0;
do {
printf("%d ", i);
i++;
} while (i < 5);
return 0;
}
Java
public class ExitConditionLoop {
public static void main(String[] args) {
int i = 0;
do {
System.out.print(i + " ");
i++;
} while (i < 5);
}
}
Python
i = 0
while i < 5:
print i,
i += 1
JavaScript
// Initialize a variable i with the value 0.
let i = 0;
// Use a do-while loop to ensure that the code inside
// the loop block is executed at least once.
do {
// Print the current value of i to the console.
console.log(i + " ");
// Increment the value of i by 1.
i++;
} while (i < 5);
8. Numbers:
Performing operations, on numbers involves addition, subtraction, multiplication and division.
C++
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
C
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
Java
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
Python
sum = a + b
difference = a - b
product = a * b
quotient = a / b
remainder = a % b
JavaScript
let sum = a + b;
let difference = a - b;
let product = a * b;
let quotient = a / b;
let remainder = a % b;
9. Characters:
Special characters called escape sequences are used to represent printable characters, such, as newline and tab.
- \n: Newline character.
- \t: Tab character.
- \": Double quote character.
- \': Single quote character.
- \\: Backslash character.
C++
#include <iostream>
int main() {
printf("Hello, world!\nThis is a new line.\n");
printf("Tabbed \t text.\n");
printf("Double quote: \"\n");
printf("Single quote: \'\n");
printf("Backslash: \\n");
return 0;
}
C
#include <stdio.h>
int main() {
printf("Hello, world!\nThis is a new line.\n");
printf("Tabbed\ttext.\n");
printf("Double quote: \"\n");
printf("Single quote: \'\n");
printf("Backslash: \\n");
return 0;
}
Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!\nThis is a new line.\n");
System.out.println("Tabbed\ttext.\n");
System.out.println("Double quote: \"\n");
System.out.println("Single quote: \'\n");
System.out.println("Backslash: \\n");
}
}
Python
print("Hello, world!\nThis is a new line.")
print("Tabbed\ttext.\n")
print("Double quote: \"\n")
print("Single quote: \'\n")
print("Backslash: \\n")
JavaScript
console.log("Hello, world!\nThis is a new line.");
console.log("Tabbed\ttext.");
console.log("Double quote: \"");
console.log("Single quote: \'");
console.log("Backslash: \\");
OutputHello, world!
This is a new line.
Tabbed text.
Double quote: "
Single quote: '
Backslash: \n
10. Arrays:
Arrays are data structures that are utilized to store and manipulate collections of elements. In languages, like C and C++ arrays are declared with a predetermined size. Initialized with values while in Java, dynamic arrays can be initialized using braces. Python on the hand provides a syntax for creating arrays. Regardless of the programming language used elements, within arrays can be accessed through indices, enabling retrieval and manipulation of data stored in the arrays.
- Create Arrays
- Initialize Arrays
- Access elements in arrays
C++
#include <iostream>
int main()
{
// Creating and Initializing an array
int myArray[5] = { 1, 2, 3, 4, 5 };
// Accessing elements in the array
for (int i = 0; i < 5; i++) {
std::cout << "Element at index " << i << ": "
<< myArray[i] << std::endl;
}
return 0;
}
C
#include <stdio.h>
int main() {
// Creating and Initializing an array
int myArray[5] = {1, 2, 3, 4, 5};
// Accessing elements in the array
for (int i = 0; i < 5; i++) {
printf("Element at index %d: %d\n", i, myArray[i]);
}
return 0;
}
Java
public class Array {
public static void main(String[] args)
{
// Creating and Initializing an array
int[] myArray = { 1, 2, 3, 4, 5 };
// Accessing elements in the array
for (int i = 0; i < myArray.length; i++) {
System.out.println("Element at index " + i
+ ": " + myArray[i]);
}
}
}
Python
# Creating and Initializing an array
my_array = [1, 2, 3, 4, 5]
# Accessing elements in the array
for i in range(len(my_array)):
print("Element at index {}: {}".format(i, my_array[i]))
JavaScript
// Creating and Initializing an array
let myArray = [1, 2, 3, 4, 5];
// Accessing elements in the array
for (let i = 0; i < 5; i++) {
console.log("Element at index " + i + ": " + myArray[i]);
}
OutputElement at index 0: 1
Element at index 1: 2
Element at index 2: 3
Element at index 3: 4
Element at index 4: 5
11. Strings- Basic String Concepts
Strings, which are sequences of characters are data types, in programming languages. They serve the purpose of representing and manipulating information. Common tasks performed on strings include combining them extracting substrings determining their length and comparing them.
In C and C++ strings are represented as arrays of characters that end with a character ('\0'). On the hand in Python and Java strings are treated as objects with built in methods, for performing operations.
C++
#include <iostream>
#include <string>
int main()
{
// String declaration and initialization
std::string myString = "Hello, GeeksforGeeks!";
// String length
std::cout << "Length of the string: "
<< myString.length() << std::endl;
// String concatenation
std::string anotherString = " How are you?";
myString += anotherString;
std::cout << "Concatenated string: " << myString
<< std::endl;
// Accessing individual characters
std::cout << "First character: " << myString[0]
<< std::endl;
return 0;
}
C
#include <stdio.h>
#include <string.h>
int main() {
// String declaration and initialization
char myString[] = "Hello, GeeksforGeeks!";
// String length
printf("Length of the string: %lu\n", strlen(myString));
// String concatenation
char anotherString[] = " How are you?";
strcat(myString, anotherString);
printf("Concatenated string: %s\n", myString);
// Accessing individual characters
printf("First character: %c\n", myString[0]);
return 0;
}
Java
public class StringExample {
public static void main(String[] args)
{
// String declaration and initialization
String myString = "Hello, GeeksforGeeks!";
// String length
System.out.println("Length of the string: "
+ myString.length());
// String concatenation
String anotherString = " How are you?";
myString = myString.concat(anotherString);
System.out.println("Concatenated string: "
+ myString);
// Accessing individual characters
System.out.println("First character: "
+ myString.charAt(0));
}
}
Python
# String declaration and initialization
my_string = "Hello, GeeksforGeeks!"
# String length
print("Length of the string:", len(my_string))
# String concatenation
another_string = " How are you?"
my_string += another_string
print("Concatenated string:", my_string)
# Accessing individual characters
print("First character:", my_string[0])
C#
using System;
class StringExample {
static void Main()
{
// String declaration and initialization
string myString = "Hello, GeeksforGeeks!";
// String length
Console.WriteLine("Length of the string: "
+ myString.Length);
// String concatenation
string anotherString = " How are you?";
myString += anotherString;
Console.WriteLine("Concatenated string: "
+ myString);
// Accessing individual characters
Console.WriteLine("First character: "
+ myString[0]);
}
}
JavaScript
class StringExample {
static main() {
// String declaration and initialization
let myString = "Hello, GeeksforGeeks!";
// String length
console.log("Length of the string: " + myString.length);
// String concatenation
let anotherString = " How are you?";
myString += anotherString;
console.log("Concatenated string: " + myString);
// Accessing individual characters
console.log("First character: " + myString.charAt(0));
}
}
// Call the main method
StringExample.main();
OutputLength of the string: 21
Concatenated string: Hello, GeeksforGeeks! How are you?
First character: H
12. Functions:
Functions are, like building blocks of code that can be reused to accomplish tasks. They play a role in organizing code making it easier to read and maintain. When defining a function you enclose a set of instructions within braces. You can also specify parameters (inputs). Return values (outputs).
C++
#include <iostream>
// Function declaration
void greet() {
std::cout << "Hello, GeeksforGeeks!" << std::endl;
}
int main() {
// Calling the function
greet();
return 0;
}
C
#include<stdio.h>
// Function declaration
void greet() {
printf("Hello, GeeksforGeeks!\n");
}
int main() {
// Calling the function
greet();
return 0;
}
Java
public class FunctionExample {
// Function declaration
static void greet() {
System.out.println("Hello, GeeksforGeeks!");
}
public static void main(String[] args) {
// Calling the function
greet();
}
}
Python
# Function definition
def greet():
print("Hello, GeeksforGeeks!")
# Calling the function
greet()
JavaScript
// Function declaration
function greet() {
console.log("Hello, GeeksforGeeks!");
}
// Calling the function
greet();
OutputHello, GeeksforGeeks!
Similar Reads
Basics & Prerequisites
Data Structures
Array Data StructureIn this article, we introduce array, implementation in different popular languages, its basic operations and commonly seen problems / interview questions. An array stores items (in case of C/C++ and Java Primitive Arrays) or their references (in case of Python, JS, Java Non-Primitive) at contiguous
3 min read
String in Data StructureA string is a sequence of characters. The following facts make string an interesting data structure.Small set of elements. Unlike normal array, strings typically have smaller set of items. For example, lowercase English alphabet has only 26 characters. ASCII has only 256 characters.Strings are immut
2 min read
Hashing in Data StructureHashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key. The
2 min read
Linked List Data StructureA linked list is a fundamental data structure in computer science. It mainly allows efficient insertion and deletion operations compared to arrays. Like arrays, it is also used to implement other data structures like stack, queue and deque. Hereâs the comparison of Linked List vs Arrays Linked List:
2 min read
Stack Data StructureA Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first
2 min read
Queue Data StructureA Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of "First in, First out" (FIFO), where the first element added to the queue is the first one to be removed. It is used as a buffer in computer systems
2 min read
Tree Data StructureTree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes. Types of TreeBinary Tree : Every node has at most two childrenTernary Tree : Every node has at most
4 min read
Graph Data StructureGraph Data Structure is a collection of nodes connected by edges. It's used to represent relationships between different entities. If you are looking for topic-wise list of problems on different topics like DFS, BFS, Topological Sort, Shortest Path, etc., please refer to Graph Algorithms. Basics of
3 min read
Trie Data StructureThe Trie data structure is a tree-like structure used for storing a dynamic set of strings. It allows for efficient retrieval and storage of keys, making it highly effective in handling large datasets. Trie supports operations such as insertion, search, deletion of keys, and prefix searches. In this
15+ min read
Algorithms
Searching AlgorithmsSearching algorithms are essential tools in computer science used to locate specific items within a collection of data. In this tutorial, we are mainly going to focus upon searching in an array. When we search an item in an array, there are two most common algorithms used based on the type of input
2 min read
Sorting AlgorithmsA Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order. There exist different sorting algorithms for differ
3 min read
Introduction to RecursionThe process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. A recursive algorithm takes one step toward solution and then recursively call itself to further move. The algorithm stops once we reach the solution
14 min read
Greedy AlgorithmsGreedy algorithms are a class of algorithms that make locally optimal choices at each step with the hope of finding a global optimum solution. At every step of the algorithm, we make a choice that looks the best at the moment. To make the choice, we sometimes sort the array so that we can always get
3 min read
Graph AlgorithmsGraph is a non-linear data structure like tree data structure. The limitation of tree is, it can only represent hierarchical data. For situations where nodes or vertices are randomly connected with each other other, we use Graph. Example situations where we use graph data structure are, a social net
3 min read
Dynamic Programming or DPDynamic Programming is an algorithmic technique with the following properties.It is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for the same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of
3 min read
Bitwise AlgorithmsBitwise algorithms in Data Structures and Algorithms (DSA) involve manipulating individual bits of binary representations of numbers to perform operations efficiently. These algorithms utilize bitwise operators like AND, OR, XOR, NOT, Left Shift, and Right Shift.BasicsIntroduction to Bitwise Algorit
4 min read
Advanced
Segment TreeSegment Tree is a data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree
3 min read
Pattern SearchingPattern searching algorithms are essential tools in computer science and data processing. These algorithms are designed to efficiently find a particular pattern within a larger set of data. Patten SearchingImportant Pattern Searching Algorithms:Naive String Matching : A Simple Algorithm that works i
2 min read
GeometryGeometry is a branch of mathematics that studies the properties, measurements, and relationships of points, lines, angles, surfaces, and solids. From basic lines and angles to complex structures, it helps us understand the world around us.Geometry for Students and BeginnersThis section covers key br
2 min read
Interview Preparation
Practice Problem