DataStructure and Algorithms Solutions with Supercool π―
ΠΡΠΊΡΡΡΡ Π² Telegram
DSA with supercool For paid projects:- Email :- supercool7151@gmail.com Follow me on social media https://linktr.ee/codemaking
ΠΠΎΠ»ΡΡΠ΅643
ΠΠΎΠ΄ΠΏΠΈΡΡΠΈΠΊΠΈ
ΠΠ΅Ρ Π΄Π°Π½Π½ΡΡ
24 ΡΠ°ΡΠ°
ΠΠ΅Ρ Π΄Π°Π½Π½ΡΡ
7 Π΄Π½Π΅ΠΉ
ΠΠ΅Ρ Π΄Π°Π½Π½ΡΡ
30 Π΄Π½Π΅ΠΉ
ΠΡΡ
ΠΈΠ² ΠΏΠΎΡΡΠΎΠ²
Geeks for Geeks cheat code Book
Practice problems in different levels
If we manage to complete easy level
We can easily crack service based companies
1. What is Linux?
Solution:-
Linux is around us since the mid 90's. It is used from wristwatches to supercomputers.
(i). Linux is an open-source operating system.
(ii). Linux Operating system is software that enables to communicate between computer hardware and software
(iii). It coveys inputs to the processed by the processer bring output to the hardware to display it
2. Evolution of Linux . ?
Solution:-
(i). Developed by Linus Torvalds in 1991
(ii). Sprouted as an idea to improve UNIX O.S
(iii). Linux is the fastest-growing O.S. It is used from phones to supercomputers by almost all major hardware devices
3. Why Linux?
Solution:-
(i). Free
(ii). Open-source
(iii). Secure
(iv). Distribution
(v). Perform Fast
4. How does Linux Work ?
Solution:-
(i). Linux is like UNIX O.S. UNIX was earlier known as UNICS(UNiplexed Information Computer Science)
(ii). Every Linux-Based O.S has the Linux Kernels and a set of software packages to manage hardware resources.
(iii). Linux includes some core GNU(GNU's not UNIX) tools to provide a way to manage hardware resources.
5. How to use Linux ?
Solution:-
We can use Linux through an intractive user interface as well as from the terminal command-line interface
Given three integers (X,Y , and Z) representing the three sides of a triangle, identify whether the triangle is scalene, isosceles, or equilateral.
If all three sides are equal, output EQUILATERAL.
Otherwise, if any two sides are equal, output ISOSCELES.
Otherwise, output SCALENE.
Input Format
Three integers, each on a new line.
Constraints
The sum of any two sides will be greater than the third.
Output Format
One word: either "SCALENE" or "EQUILATERAL" or "ISOSCELES" (quotation marks excluded).
Sample Input
Sample Input 1
2
3
4
Sample Input 2
6
6
6
Sample Output
Sample Output 1
SCALENE
Sample Output 2
EQUILATERAL
Solution:-
read firsti
read secondi
read thirdi
if [ $firsti -eq $secondi ]; then
if [ $secondi -eq $thirdi ]; then
echo EQUILATERAL
else
echo ISOSCELES
fi
elif [ $firsti -eq $secondi ]; then
echo ISOSCELES
elif [ $secondi -eq $thirdi ]; then
echo ISOSCELES
else
echo SCALENE
fi
Read in one character from STDIN.
If the character is 'Y' or 'y' display "YES".
If the character is 'N' or 'n' display "NO".
No other character will be provided as input.
Input Format
One character
Constraints
The character will be from the set .
Output Format
echo YES or NO to STDOUT.
Sample Input
Solution:-
read char
case $char in
Y|y) echo "YES";;
N|n) echo "NO";;
*) echo
esac
Given two integers, X and ,Y identify whether XY or X=Y .
Exactly one of the following lines:
- X is less than Y
- X is greater than Y
- X is equal to Y
Input Format
Two lines containing one integer each (X and , Y respectively).
Constraints
-
Output Format
Exactly one of the following lines:
- X is less than Y
- X is greater than Y
- X is equal to Y
Sample Input
Sample Input 1
5
2
Sample Input 2
2
2
Sample Input 3
2
3
Sample Output
Sample Output 1
X is greater than Y
Sample Output 2
X is equal to Y
Sample Output 3
X is less than Y
Solution :-
read firsti
read secondi
if [ $firsti -lt $secondi ]; then
echo X is less than Y
elif [ $firsti -gt $secondi ]; then
echo X is greater than Y
else [ $firsti -eq $secondi ]
echo X is equal to Y
fi
Given two integers, Y and , X find their sum, difference, product, and quotient.
Input Format
Two lines containing one integer each ( and , respectively).
Constraints
Output Format
Four lines containing the sum (X+Y), difference (X-Y), product (X * Y), and quotient (X / Y), respectively.
(While computing the quotient, print only the integer part.)
Sample Input
5
2
Sample Output
7
3
10
2
Explanation
5 + 2 = 7
5 - 2 = 3
5 * 2 = 10
5 / 2 = 2 (Integer part)
Solution:-
read firsti
read secondi
add=$(($firsti+secondi))
echo $add
sub=$(($firsti-$secondi))
echo $sub
multi=$(($firsti*$secondi))
echo $multi
div=$(($firsti/$secondi))
echo $div
Use a for loop to display the natural numbers from 1 to 50 ?
Solution :-
for i in {1..50..0}
do
echo $i
done
Write a Bash script which accepts name as input and displays the greeting "Welcome (name)" ?
Solution:-
read name
echo Welcome $name
output :-
username called anything like , supercool , Dan , javaTpoint and more.
Your task is to use for loops to display only odd natural numbers from 1 to 99 ?
Solution:-
for i in {1..99..2}
do
echo $i
done
This is how we can use for loop in Linux Operating system
How to print Hello world in Linux ?
printf "Hello guys, Welcome to my channelπ"
echo "code with supercool_5"
We can use this commands to print strings in Linux
