https://github.com/sudeep065/string-data-algorithms-collection
This is a code collection of all the String Manipulation data algorithms with the sample input and output.
https://github.com/sudeep065/string-data-algorithms-collection
binary-search binary-search-tree bubble-sort-algorithm reverse-strings search-algorithm
Last synced: 5 months ago
JSON representation
This is a code collection of all the String Manipulation data algorithms with the sample input and output.
- Host: GitHub
- URL: https://github.com/sudeep065/string-data-algorithms-collection
- Owner: sudeep065
- Created: 2021-02-21T01:08:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-16T14:47:49.000Z (over 4 years ago)
- Last Synced: 2025-03-16T19:49:16.999Z (9 months ago)
- Topics: binary-search, binary-search-tree, bubble-sort-algorithm, reverse-strings, search-algorithm
- Language: C#
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Table of Contents
* [Quick Start](#quick-start)
* [Simple Superreduced](#Simple-Superreduced)
## Terminal Commands
This project was generated with Console using [Visual Studio 2019 Free Version click to download](https://visualstudio.microsoft.com/downloads/) version 16.8.4
## Simple-Superreduced
Complete the superReducedString function below
Sample Input
string="aaabccddd"
Sample Output
abd
Explanation- Remove next matching char, if its just repeated 2/4 times then remove completely, if itz odd numbers, then you we need to keep it.
aaabccddd -> aabccddd -> abccddd -> abddd -> abdd -> abd
## RepeatedString
There is a string s, of lowercase English letters that is repeated infinitely many times. Given an integer n,find and print the number of letter a's in the first n letters of the infinite string.
Example Input
aba
10
Sample Output
7
Explanation 0
The first n=10 letters of the infinite string are "abaabaabaa". Because there are 7 a's, we return 7.
Efficient HackerRank solutions in C# programmed by Sudeep
# 10 Days of Statistics
| | Day | Problem | Solution | Difficulty | Points | Note |
|-- |:---:|:---------------:|:--------:|:----------:|:------:|:----:|
| ⭐ | 9 |[Multiple Linear Regression (Last day)](https://www.hackerrank.com/challenges/s10-multiple-linear-regression/problem)| [JavaScript](10-days-of-statistics/s10-multiple-linear-regression.js) | Medium | 30 | |
| | 8 |[Least Square Regression Line](https://www.hackerrank.com/challenges/s10-least-square-regression-line/problem)| [JavaScript](10-days-of-statistics/s10-least-square-regression-line.js) | Easy | 30 | |
| | 7 |[Spearman's Rank Correlation Coefficient](https://www.hackerrank.com/challenges/s10-spearman-rank-correlation-coefficient/problem)| [JavaScript](10-days-of-statistics/s10-spearman-rank-correlation-coefficient.js) | Easy | 30 | |
| | 7 |[Pearson Correlation Coefficient I](https://www.hackerrank.com/challenges/s10-pearson-correlation-coefficient/problem)| [JavaScript](10-days-of-statistics/s10-pearson-correlation-coefficient.js) | Easy | 30 | |
| | 6 |[The Central Limit Theorem III](https://www.hackerrank.com/challenges/s10-the-central-limit-theorem-3/problem)| [JavaScript](10-days-of-statistics/s10-the-central-limit-theorem-3.js) | Easy | 30 | |
| | 6 |[The Central Limit Theorem II](https://www.hackerrank.com/challenges/s10-the-central-limit-theorem-2/problem)| [JavaScript](10-days-of-statistics/s10-the-central-limit-theorem-2.js) | Easy | 30 | |
| | 6 |[The Central Limit Theorem I](https://www.hackerrank.com/challenges/s10-the-central-limit-theorem-1/problem)| [JavaScript](10-days-of-statistics/s10-the-central-limit-theorem-1.js) | Easy | 30 | |
| | 5 |[Normal Distribution II](https://www.hackerrank.com/challenges/s10-normal-distribution-2/problem)| [JavaScript](10-days-of-statistics/s10-normal-distribution-2.js) | Easy | 30 | |
| | 5 |[Normal Distribution I](https://www.hackerrank.com/challenges/s10-normal-distribution-1/problem)| [JavaScript](10-days-of-statistics/s10-normal-distribution-1.js) | Easy | 30 | |
| | 5 |[Poison Distribution II](https://www.hackerrank.com/challenges/s10-poisson-distribution-2/problem)| [JavaScript](10-days-of-statistics/s10-poisson-distribution-2.js) | Easy | 30 | |
| | 5 |[Poison Distribution I](https://www.hackerrank.com/challenges/s10-poisson-distribution-1/problem)| [JavaScript](10-days-of-statistics/s10-poisson-distribution-1.js) | Easy | 30 | |
| | 4 |[Geometric Distribution II](https://www.hackerrank.com/challenges/s10-geometric-distribution-2/problem)| [JavaScript](10-days-of-statistics/s10-geometric-distribution-2.js) | Easy | 30 | |
| | 4 |[Geometric Distribution I](https://www.hackerrank.com/challenges/s10-geometric-distribution-1/problem)| [JavaScript](10-days-of-statistics/s10-geometric-distribution-1.js) | Easy | 30 | |
| | 4 |[Binomial Distribution II](https://www.hackerrank.com/challenges/s10-binomial-distribution-2/problem)| [JavaScript](10-days-of-statistics/s10-binomial-distribution-2.js) | Easy | 30 | |
| | 4 |[Binomial Distribution I](https://www.hackerrank.com/challenges/s10-binomial-distribution-1/problem)| [JavaScript](10-days-of-statistics/s10-binomial-distribution-1.js) | Easy | 30 | |
| | 2 |[Compound Event Probability](https://www.hackerrank.com/challenges/s10-mcq-3/problem)| [JavaScript](10-days-of-statistics/s10-mcq-3.js) | | | |
| | 2 |[More Dice](https://www.hackerrank.com/challenges/s10-mcq-2/problem)| [JavaScript](10-days-of-statistics/s10-mcq-2.js) | | | |
| | 2 |[Basic Probability](https://www.hackerrank.com/challenges/s10-mcq-1/problem)| [JavaScript](10-days-of-statistics/s10-mcq-1.js) | | | |
| | 1 |[Standard Deviation](https://www.hackerrank.com/challenges/s10-standard-deviation/problem)| [JavaScript](10-days-of-statistics/s10-standard-deviation.js) | Easy | 30 | |
| | 1 |[Interquartile Range](https://www.hackerrank.com/challenges/s10-interquartile-range/problem)| [JavaScript](10-days-of-statistics/s10-interquartile-range.js) | Easy | 30 | |
| | 1 |[Quartiles](https://www.hackerrank.com/challenges/s10-quartiles.js/problem)| [JavaScript](10-days-of-statistics/s10-quartiles.js) | Easy | 30 | |
| | 0 |[Weighted Mean](https://www.hackerrank.com/challenges/s10-weighted-mean/problem)| [JavaScript](10-days-of-statistics/s10-weighted-mean.js) | Easy | 30 | |
| | 0 |[ Mean, Median, and Mode](https://www.hackerrank.com/challenges/s10-basic-statistics/problem)| [JavaScript](10-days-of-statistics/s10-basic-statistics.js) | Easy | 30 | |
---
# Algorithms
## Implementation
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| ⭐ |[Matrix Layer Rotation](https://www.hackerrank.com/challenges/matrix-rotation-algo/problem)| [JavaScript](algorithms/implementation/matrix-rotation-algo.js) | Hard | 80 | Math solution to the problem, _O(1)_ if the loop to print the result isn't considered, otherwise _O(m*n)_ |
| ⭐ |[ACM ICPC Team](https://www.hackerrank.com/challenges/acm-icpc-team/problem)| [JavaScript](algorithms/implementation/acm-icpc-team.js) | Easy | 25 | Using bitwise operations, and a custom Hamming Weight implementation to count ones, because the HackerRank's v8 version hasn't yet a BigInt implementation. Best case _O(n^2)_ where _n_ is the topics length |
| ⭐ |[Queen's Attack II](https://www.hackerrank.com/challenges/queens-attack-2/problem)| [JavaScript](algorithms/implementation/queens-attack-2.js) | Medium | 30 | Math solution to the problem, _O(k)_, where _k_ is the number of obstacles |
| ⭐ |[Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers/problem)| [JavaScript](algorithms/implementation/kaprekar-numbers.js) | Easy | 30 | Math and very performatic solution, without using Strings nor brute force, _O(n)_, where n = q - p |
| |[Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array/problem)| [JavaScript](algorithms/implementation/equality-in-a-array.js) | Easy | 20 | _O(n)_ |
| ⭐ |[Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem)| [JavaScript](algorithms/implementation/jumping-on-the-clouds.js) | Easy | 20 | _O(log n)_ |
| ⭐ |[Repeated String](https://www.hackerrank.com/challenges/repeated-string/problem)| [JavaScript](algorithms/implementation/repeated-string.js) | Easy | 20 | The algorithm doesn't count the string a second time, both best and worst case is _O(n)_ where _n_ is the length of the string |
| |[Lisa's Workbook](https://www.hackerrank.com/challenges/lisa-workbook/problem)| [JavaScript](algorithms/implementation/lisa-workbook.js) | Easy | 25 | |
| |[Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater/problem)| [JavaScript](algorithms/implementation/bigger-is-greater.js) | Medium | 35 | |
| |[Organizing Containers of Balls](https://www.hackerrank.com/challenges/organizing-containers-of-balls/problem)| [JavaScript](algorithms/implementation/organizing-containers-of-balls.js) | Medium | 30 | |
| |[The Time in Words](https://www.hackerrank.com/challenges/the-time-in-words/problem)| [JavaScript](algorithms/implementation/the-time-in-words.js) | Medium | 25 | _O(1)_ |
| |[Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets/problem)| [JavaScript](algorithms/implementation/beautiful-triplets.js) | Easy | 20 | _O(n)_ |
| |[Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances/problem)| [JavaScript](algorithms/implementation/minimum-distances.js) | Easy | 20 | _O(n)_ |
| |[Halloween Sale](https://www.hackerrank.com/challenges/halloween-sale/problem)| [JavaScript](algorithms/implementation/halloween-sale.js) | Easy | 20 | _O(1)_ |
| |[Non-Divisible Subset](https://www.hackerrank.com/challenges/non-divisible-subset/problem)| [JavaScript](algorithms/implementation/non-divisible-subset.js) | Medium | 20 | |
| |[Cut the Sticks](https://www.hackerrank.com/challenges/cut-the-sticks/problem)| [JavaScript](algorithms/implementation/cut-the-sticks.js) | Easy | 25 | |
| |[Library Fine](https://www.hackerrank.com/challenges/library-fine/problem)| [JavaScript](algorithms/implementation/library-fine.js) | Easy | 15 | _O(1)_ |
| |[Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares/problem)| [JavaScript](algorithms/implementation/sherlock-and-squares.js) | Easy | 20 | _O(1)_ |
| |[Append and Delete](https://www.hackerrank.com/challenges/append-and-delete/problem)| [JavaScript](algorithms/implementation/append-and-delete.js) | Easy | 20 | _O(min(s, t))_ |
| |[Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials/problem)| [JavaScript](algorithms/implementation/extra-long-factorials.js) | Medium | 20 | |
| |[Service Lane](https://www.hackerrank.com/challenges/service-lane/problem)| [JavaScript](algorithms/implementation/service-lane.js) | Easy | 20 | |
| |[Chocolate Feast](https://www.hackerrank.com/challenges/chocolate-feast/problem)| [JavaScript](algorithms/implementation/chocolate-feast.js) | Easy | 25 | _O(1)_ |
| |[Find Digits](https://www.hackerrank.com/challenges/find-digits/problem)| [JavaScript](algorithms/implementation/find-digits.js) | Easy | 25 | _O(n)_ |
| |[Jumping on the Clouds: Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited/problem)| [JavaScript](algorithms/implementation/jumping-on-the-clouds-revisited.js) | Easy | 15 | _O(n / k)_ where _k_ is the number of jumps |
| |[Sequence Equation](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited/problem)| [JavaScript](algorithms/implementation/permutation-equation.js) | Easy | 20 | |
| |[Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation/problem)| [JavaScript](algorithms/implementation/circular-array-rotation.js) | Easy | 20 | |
| |[Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner/problem)| [JavaScript](algorithms/implementation/save-the-prisoner.js) | Easy | 15 | _O(1)_ |
| ⭐ |[Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising/problem)| [JavaScript](algorithms/implementation/strange-advertising.js) | Easy | 15 | Alternative way to solve it using this integer sequence formula: https://oeis.org/A061418 |
| |[Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies/problem)| [JavaScript](algorithms/implementation/beautiful-days-at-the-movies.js) | Easy | 15 | _O(n)_ |
| |[Angry Professor](https://www.hackerrank.com/challenges/angry-professor/problem)| [JavaScript](algorithms/implementation/angry-professor.js) | Easy | 20 | _O(n)_ |
| |[Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree/problem)| [JavaScript](algorithms/implementation/utopian-tree.js) | Easy | 20 | _O(1)_ |
| |[Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer/problem)| [JavaScript](algorithms/implementation/designer-pdf-viewer.js) | Easy | 20 | |
| |[The Hurdle Race](https://www.hackerrank.com/challenges/the-hurdle-race/problem)| [JavaScript](algorithms/implementation/the-hurdle-race.js) | Easy | 15 | _O(1)_ |
| |[Climbing the Leaderboard](https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem)| [JavaScript](algorithms/implementation/climbing-the-leaderboard.js) | Medium | 20 | _O(n + log(m))_ |
| |[Picking Numbers](https://www.hackerrank.com/challenges/picking-numbers/problem)| [JavaScript](algorithms/implementation/picking-numbers.js) | Easy | 20 | _O(1)_ |
| ⭐ |[Forming a Magic Square](https://www.hackerrank.com/challenges/magic-square-forming/problem)| [JavaScript](algorithms/implementation/magic-square-forming.js) | Medium | 20 | Using Édouard Lucas general formula to generate all possible magic squares of order 3 |
| |[Cats and a Mouse](https://www.hackerrank.com/challenges/cats-and-a-mouse/problem)| [JavaScript](algorithms/implementation/cats-and-a-mouse.js) | Easy | 15 | _O(1)_ |
| |[Eletronics Shop](https://www.hackerrank.com/challenges/electronics-shop/problem)| [JavaScript](algorithms/implementation/electronics-shop.js) | Easy | 15 | |
| |[Counting Valleys](https://www.hackerrank.com/challenges/counting-valleys/problem)| [JavaScript](algorithms/implementation/counting-valleys.js) | Easy | 15 | _O(n)_ |
| |[Drawing Book](https://www.hackerrank.com/challenges/drawing-book/problem)| [JavaScript](algorithms/implementation/drawing-book.js) | Easy | 10 | _O(1)_ |
| |[Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant/problem)| [JavaScript](algorithms/implementation/sock-merchant.js) | Easy | 10 | _O(1)_ |
| |[Bon Appétit](https://www.hackerrank.com/challenges/bon-appetit/problem)| [JavaScript](algorithms/implementation/bon-appetit.js) | Easy | 10 | _O(n)_ |
| |[Day of the Programmer](https://www.hackerrank.com/challenges/day-of-the-programmer/problem)| [JavaScript](algorithms/implementation/day-of-the-programmer.js) | Easy | 10 | _O(1)_ |
| |[Migratory Birds](https://www.hackerrank.com/challenges/migratory-birds/problem)| [JavaScript](algorithms/implementation/migratory-birds.js) | Easy | 10 | |
| |[Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs/problem)| [JavaScript](algorithms/implementation/divisible-sum-pairs.js) | Easy | 10 | |
| |[Birthday Chocolate](https://www.hackerrank.com/challenges/the-birthday-bar/problem)| [JavaScript](algorithms/implementation/the-birthday-bar.js) | Easy | 10 | ||
| |[Breaking the Records](https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem)| [JavaScript](algorithms/implementation/breaking-best-and-worst-records.js) | Easy | 10 | _O(n)_ |
| |[Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets/problem)| [JavaScript](algorithms/implementation/between-two-sets.js) | Easy | 10 | Using Euclid's division algorithm for greatest common divisor |
| |[Kangaroo](https://www.hackerrank.com/challenges/kangaroo/problem)| [JavaScript](algorithms/implementation/kangaroo.js) | Easy | 10 | |
| |[Apple and Orange](https://www.hackerrank.com/challenges/apple-and-orange/problem)| [JavaScript](algorithms/implementation/apple-and-orange.js) | Easy | 10 | |
| |[Grading Students](https://www.hackerrank.com/challenges/grading/problem)| [JavaScript](algorithms/implementation/grading.js) | Easy | 10 | |
## Data Structures
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| |[Array Manipulation](https://www.hackerrank.com/challenges/crush/problem)| [JavaScript](algorithms/data-structures/crush.js) | Hard | 60 | |
| |[Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays/problem)| [JavaScript](algorithms/data-structures/sparse-arrays.js) | Medium | 25 | |
| |[Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array/problem)| [JavaScript](algorithms/data-structures/dynamic-array.js) | Easy | 15 | |
| |[Array DS](https://www.hackerrank.com/challenges/array-ds/problem)| [JavaScript](algorithms/data-structures/arrays-ds.js) | Easy | 10 | |
## Constructive Algorithms
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| |[New Year Chaos](https://www.hackerrank.com/challenges/new-year-chaos/problem)| [JavaScript](algorithms/constructive-algorithms/new-year-chaos.js) | Medium | 40 | |
## Warmup
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| |[Time Conversion](https://www.hackerrank.com/challenges/time-conversion/problem)| [JavaScript](algorithms/warmup/time-conversion.js) | Easy | 15 | |
| |[Birthday Cake Candles](https://www.hackerrank.com/challenges/birthday-cake-candles/problem)| [JavaScript](algorithms/warmup/birthday-cake-candles.js) | Easy | 10 | |
| |[Mini-Max Sum](https://www.hackerrank.com/challenges/mini-max-sum/problem)| [JavaScript](algorithms/warmup/mini-max-sum.js) | Easy | 10 | |
| |[Staircase](https://www.hackerrank.com/challenges/staircase/problem)| [JavaScript](algorithms/warmup/staircase.js) | Easy | 10 | |
| |[Plus Minus](https://www.hackerrank.com/challenges/plus-minus/problem)| [JavaScript](algorithms/warmup/plus-minus.js) | Easy | 10 | |
| |[Diagonal Difference](https://www.hackerrank.com/challenges/diagonal-difference/problem)| [JavaScript](algorithms/warmup/diagonal-difference.js) | Easy | 10 | |
| |[A Very Big Sum](https://www.hackerrank.com/challenges/a-very-big-sum/problem)| [JavaScript](algorithms/warmup/a-very-big-sum.js) | Easy | 10 | |
| |[Compare the Triplets](https://www.hackerrank.com/challenges/compare-the-triplets.js/problem)| [JavaScript](algorithms/warmup/compare-the-triplets.js) | Easy | 10 | |
---
# Mathematics
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| |[Army Game](https://www.hackerrank.com/challenges/game-with-cells/problem)| [JavaScript](mathematics/game-with-cells.js) | Easy | 10 | |
| |[Minimum Height Triangle](https://www.hackerrank.com/challenges/lowest-triangle/problem)| [JavaScript](mathematics/lowest-triangle.js) | Easy | 10 | |
| |[Handshake](https://www.hackerrank.com/challenges/handshake/problem)| [JavaScript](mathematics/handshake.js) | Easy | 10 | |
| |[Maximum Draws](https://www.hackerrank.com/challenges/maximum-draws/problem)| [JavaScript](mathematics/maximum-draws.js) | Easy | 5 | |
| |[Find the Point](https://www.hackerrank.com/challenges/find-point/problem)| [JavaScript](mathematics/find-point.js) | Easy | 5 | |
---
# Interview Preparation Kit
## Arrays
| | Problem | Solution | Difficulty | Points | Note |
|-- |:---------------:|:--------:|:----------:|:------:|:----:|
| |[Minimun Swaps 2](https://www.hackerrank.com/challenges/minimum-swaps-2/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays)| [JavaScript](interview-preparation-kit/minimum-swaps-2.js) | Medium | 40 | |
| |[Arrays: Left Rotation](https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays)| [JavaScript](interview-preparation-kit/array-left-rotation.js) | Easy | 15 | |
| |[2D Array - DS](https://www.hackerrank.com/challenges/2d-array/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays)| [JavaScript](interview-preparation-kit/2d-array.js) | Easy | 15 | |