Coder Social home page Coder Social logo

thomas-george-t / hackerrank-the-linux-shell-challenges-solutions Goto Github PK

View Code? Open in Web Editor NEW
77.0 4.0 48.0 92 KB

Complete Solutions and related tutorials for the Linux Shell - Bash, text processing, Arrays in Bash, Grep Sed Awk Challenges on HackerRank

License: MIT License

Shell 100.00%
linux bash hackerrank hackerrank-solutions shell linux-shell challenge tutorial text-processing unix

hackerrank-the-linux-shell-challenges-solutions's Introduction

GitHub GitHub top language GitHub last commit ViewCount




Description

Solutions to all the easy, medium and hard challenges compiled with related learning resources for the Linux Shell Challenges on HackerRank.

Domains included:

Bash Challenges

Number Challenges Solutions
1 Let's Echo! Solution.sh
2 Looping and Skipping Solution.sh
3 A Personalized Echo Solution.sh
4 Looping with numbers Solution.sh
5 The World of Numbers Solution.sh
6 Comparing Numbers Solution.sh
7 Getting started with conditionals Solution.sh
8 More on Conditionals Solution.sh
9 Arithmetic Operations Solution.sh
10 Compute the Average Solution.sh
11 Functions and Fractals - Recursive Trees - Bash! Solution.sh

Text Processing

Number Challenge Solutions
1 Cut #1 Solution
2 Cut #2 Solution
3 Cut #3 Solution
4 Cut #4 Solution
5 Cut #5 Solution
6 Cut #6 Solution
7 Cut #7 Solution
8 Cut #8 Solution
9 Cut #9 Solution
10 Head of a Text File #1 Solution
11 Head of a Text File #2 Solution
12 Middle of a Text File Solution
13 Tail of a Text File #1 Solution
14 Tail of a Text File #2 Solution
15 'Tr' Command #1 Solution
16 'Tr' Command #2 Solution
17 'Tr' Command #3 Solution
18 Sort Command #1 Solution
19 Sort Command #2 Solution
20 Sort Command #3 Solution
21 Sort Command #4 Solution
22 Sort Command #5 Solution
23 Sort Command #6 Solution
24 Sort Command #7 Solution
25 'Uniq' Command #1 Solution
26 'Uniq' Command #2 Solution
27 'Uniq' Command #3 Solution
28 'Uniq' Command #4 Solution
29 Paste - 1 Solution
30 Paste - 2 Solution
31 Paste - 3 Solution
32 Paste - 4 Solution

Arrays in Bash

Number Challenge Solutions
1 Read in an Array Solution
2 Slice an Array Solution
3 Filter an Array with Patterns Solution
4 Concatenate an array with itself Solution
5 Display an element of an array Solution
6 Count the number of elements in an Array Solution
7 Remove the First Capital Letter from Each Element Solution
8 Lonely Integer - Bash! Solution

Grep Sed Awk

Number Challenge Solutions
1 'Grep' #1 Solution
2 'Grep' #2 Solution
3 'Grep' #3 Solution
4 'Grep' -A Solution
5 'Grep' -B Solution
6 'Sed' command #1 Solution
7 'Sed' command #2 Solution
8 'Sed' command #3 Solution
9 'Sed' command #4 Solution
10 'Sed' command #5 Solution
11 'Awk' - 1 Solution
12 'Awk' - 2 Solution
13 'Awk' - 3 Solution
14 'Awk' - 4 Solution

Featured in

References, Tutorials and Relevant Materials

General

Bash

Text Processing

Arrays in Bash

hackerrank-the-linux-shell-challenges-solutions's People

Contributors

arsfiqball avatar madhurthareja avatar phuongvo1711 avatar sounishnath003 avatar thomas-george-t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hackerrank-the-linux-shell-challenges-solutions's Issues

[Solution]: Functions and Fractals - Recursive Trees - Bash!

Hello! โœŒ

I started learning Shell Scripting and started practicing at Hackerrank and while practicing questions I stuck at Functions and Fractals question and google search to get the idea of solution I found your repo as my first result!

As a beginner who started learning Shell scripting, I found your this repository very helpful, each command I first learning from youtube & when stuck I reach out to this repository.

The mentioned question does not have a solution, nor I could solve it, I found an answer, and want to contribute to this repository with the solution I got.

declare -A a

# credits to https://github.com/MaskRay/HackerRank/blob/master/shell/fractal-trees-all.sh
# d - depth
# l = length
# r = row
# c = column

f() {
    local d=$1 l=$2 r=$3 c=$4
    [[ $d -eq 0 ]] && return
    for ((i=l; i; i--)); do
        a[$((r-i)).$c]=1
    done
    ((r -= l))
    for ((i=l; i; i--)); do
        a[$((r-i)).$((c-i))]=1
        a[$((r-i)).$((c+i))]=1
    done
    f $((d-1)) $((l/2)) $((r-l)) $((c-l))
    f $((d-1)) $((l/2)) $((r-l)) $((c+l))
}
read n
f $n 16 63 49
for ((i=0; i<63; i++)); do
    for ((j=0; j<100; j++)); do
        if [[ ${a[$i.$j]} ]]; then
            printf 1
        else
            printf _
        fi
    done
    echo
done

I hope this adds a complete mark to your repository and it will eventually help people in the community!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.