# Breaking the Records in Algorithm | HackerRank Programming Solutions | HackerRank Problem Solving Solutions in Java [💯Correct]

Hello Programmers/Coders, Today we are going to share solutions of Programming problems of HackerRank, Algorithm Solutions of Problem Solving Section in Java. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for Breaking the Records in Java-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

#### Introduction To Algorithm

The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed upon in order to get the expected results.

• It is easy to understand.
• Algorithm is a step-wise representation of a solution to a given problem.
• In Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program.

Link for the ProblemBreaking the Records – Hacker Rank Solution

Breaking the Records – Hacker Rank Solution

### Problem:

Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of times she breaks her season record for most points and least points in a game. Points scored in the first game establish her record for the season, and she begins counting from there.

Example

Scores are in the same order as the games played. She tabulates her results as follows:

Count
Game  Score  Minimum  Maximum   Min Max
0      12     12       12       0   0
1      24     12       24       0   1
2      10     10       24       1   1
3      24     10       24       1   1

Given the scores for a season, determine the number of times Maria breaks her records for most and least points scored during the season.

Function Description

Complete the breakingRecords function in the editor below.

breakingRecords has the following parameter(s):

• int scores[n]: points scored per game

Returns

• int[2]: An array with the numbers of times she broke her records. Index  is for breaking most points records, and index  is for breaking least points records.

Input Format

Sample Input 0

9
10 5 20 20 4 5 2 25 1

Sample Output 0

2 4

Explanation 0

The diagram below depicts the number of times Maria broke her best and worst records throughout the season:

She broke her best record twice (after games  and ) and her worst record four times (after games , , , and ), so we print 2 4 as our answer. Note that she did not break her record for best score during game , as her score during that game was not strictly greater than her best record at the time.

Sample Input 1

10
3 4 21 36 10 28 35 5 24 42

Sample Output 1

4 0

Explanation 1

The diagram below depicts the number of times Maria broke her best and worst records throughout the season:

She broke her best record four times (after games , , , and ) and her worst record zero times (no score during the season was lower than the one she earned during her first game), so we print 4 0 as our answer.

Breaking the Records – Hacker Rank Solution
import java.util.Scanner;

/**
* @author Techno-RJ
*
*/
public class BreakingTheRecords {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] score = new int[n];
int baseScore = in.nextInt();
int bestScoreCount = 0, leastScoreCount = 0;
int baseBestScore = baseScore, baseLeastScore = baseScore;
for (int score_i = 1; score_i < n; score_i++) {
score[score_i] = in.nextInt();
if (score[score_i] < baseLeastScore) {
baseLeastScore = score[score_i];
leastScoreCount++;
}
if (score[score_i] > baseBestScore) {
baseBestScore = score[score_i];
bestScoreCount++;
}
}
System.out.println(bestScoreCount + " " + leastScoreCount);
in.close();
}
}

### 605 thoughts on “Breaking the Records in Algorithm | HackerRank Programming Solutions | HackerRank Problem Solving Solutions in Java [💯Correct]”

1. It is appropriate time to make some plans for the future
and it is time to be happy. I’ve read this post
and if I could I wish to suggest you some interesting things
or suggestions. Perhaps you could write next articles referring to this

2. Istnieje kilka rodzajów ruletki (na przykład rosyjska, europejska, francuska itp.), z których każda ma swoje własne cechy i różnice. Ruletka francuska i europejska różnią się strukturą koła gry, które podzielone jest na 37 sektorów. 36 komórek na kole ruletki z liczbami i ostatni sektor o wartości zerowej (zero), co zapewnia kasynu dodatkowy dochód w wysokości 2,7%. Ruletka online bez depozytu nie wymaga od nas również logowania i rejestracji. Możemy więc spać spokojnie, z myślą, że nasza skrzynka nie zostanie zaspamowana dziesiątkami newsletterów i informacji o zniżkach. Bardzo często bowiem podczas rejestracji zdarza się przez przypadek wyrazić zgodę na otrzymywanie maili marketingowych, które bywają niesamowicie uporczywe. Ruletka gra dostępna na naszej stronie nie zmusi Cię nigdy do podania swojego maila, ponieważ wszystko jest u nas dostępne bez rejestracji i ukrytych kosztów!
http://www.famfamfesta.com/bbs/board.php?bo_table=free&wr_id=13220
Doświadczenie krupiera jest kluczowe dla uzyskania najlepszych wrażeń z gry, gracz otrzymuje potwierdzenie transakcji. Bonusy bez depozytu naprawdę są uwielbiane przez graczy nie bez powodu — przede wszystkim są łatwe do uzyskania, ponieważ wystarczy tylko zarejestrować nowe kontoi wykonać GGBet zaloguj. Nie jest wymagana żadna wpłata! 3. niezaleganie z zapłatą składek na ubezpieczenia społeczne oraz na ubezpieczenie zdrowotne. kw. 12, 2023 Jakie sloty są najbardziej opłacalne w kasynach online? Krupier jest jednak bardziej formalnym i dokładnym terminem, że możesz grać na prawdziwe pieniądze w kasynie online i nie musisz robić depozytu. Jest to integralna część procesu podejmowania decyzji, mamy wymienione wiele kasyn. Czy chcesz grać w gry na stronach kasyn nieobjętych GamStop Polska, kasyno online po polsku z obsługą klienta w języku polskim które akceptują go do wypróbowania.

3. where buy cheap mobic pills [url=https://mobic.store/#]can i order mobic for sale[/url] can i buy generic mobic online

4. Get here.
mens erection pills: new ed pills – ed treatment pills
Drugs information sheet.

5. the best ed pills [url=https://cheapestedpills.com/#]best ed drugs[/url] cure ed

8. Data livescore yang kami tampilkan real time dari siaran langsung pertandingan, kartu kuning, kartu merah dapat Anda lihat. Selain itu kami juga menyediakan data statistik riwayat H2H pertandingan setiap tim yang bertanding. Saksikan dan bookmarks halaman ini untuk tidak ketinggalan update livescore terbaru setiap harinya. Tidak perlu keheranan terhadap situs spbobos ini yang memiliki banyak sekali peminat yang ingin sekali bergabung dan bermain disitus ini, dengan banyak sekali keuntungan menarik dan kelebihan yang tidak akan didapatkan melalui situs prediksi lainnya diluar sana yang tidak memiliki kelengkapan setiap pertandingan sportsbook yang menjadi hal yang sangat penting untuk semua pecinta betting online. Did you miss the live scores yesterday? Our livescores page will tell you all you need to know and it’s a page you really need to read. Whether your favourite football team played yesterday or not, there is a reason to check the results of the matches: to build up a solid knowledge to succeed in sports betting! By gathering as much information and statistics about each team and competition as possible, you are effectively putting yourself in the best possible position when making successful football predictions.
https://www.oscarbookmarks.win/best-football-prediction-for-tomorrow
Home >> Football Live Scores :: Wednesday’s matches Exclusive offer The 12 UEFA Nations League group winners (4 from League A, 4 from League B, and 4 from League C) advance to the Euro playoffs unless they’ve already qualified directly via Euro 2024 qualifying. If already qualified, that country’s place in the playoffs will be taken by the next highest-ranked team in their specific league (i.e. League A, B or C).  The Lionesses midfielder is heading to the 2023 Women’s World Cup hoping to back up that Euro 2022 title. But what will she pack for Australia? SOCIAL MEDIA Exclusive offer from Vbet It was England’s first knockout round victory inside 90 minutes at the Euros and came after midfielder Jack Grealish was introduced in the 69th minute.

10. I always used to read post in news papers but now as I am a user
of net therefore from now I am using net for content, thanks to web.

11. Howdy would you mind letting me know which web host you’re utilizing?

Can you recommend a good internet hosting provider at a honest price?
Thank you, I appreciate it!

12. Poniżej przedstawiamy kilka przykładów firm, które zdecydowały się na zmianę swojego modelu biznesowego. Maszyny do gier hot spot kasyno online na prawdziwe pieniadze Kasynowy bonus powitalny dla graczy. Czym jest? Poznaj kasyno bez depozytu 2022 i odbierz najnowsze oferty. Kasyno online bez depozytu daje nam darmowy bonus bez depozytu lub free spiny bez depozytu! Gryhazardowehotspot.pl 2012 Kasyno Online w Polsce Temat jest oczywiście świetnie znany, bo bez niego nie może działać i funkcjonować żadne poważne kasyno online. Znajdziemy tam zatem świetnie rozpisany dział FAQ, gdzie odpowiedziano na kluczowe pytania i nurtujące kwestie. Firmy decydują się na zmianę swojego modelu biznesowego z różnych powodów. Najczęściej wynika to z konieczności dostosowania się do zmieniających się warunków rynkowych, w tym do zmieniających się potrzeb i preferencji klientów, postępującej konkurencji, szybko rozwijającej się technologii i zmieniających się trendów rynkowych.
https://wiki-global.win/index.php?title=Rosyjska_ruletka_gra_dla_rodziny
1. Miejski Ośrodek Pomocy Rodzinie, 86-300 Grudziądz, ul. Waryńskiego 34A Dzieci ze Świetlicy Przystań miały okazję uczestniczyć w przedstawieniu Bajki pt. ”Kruszynka”. Bajka, ta została przygotowana i zaprezentowana przez naszych wychowanków Bursy Szkolnej Caritas Diecezji Toruńskiej w Grudziądzu. Podczas przedstawienia dzieci z uwagą i w skupieniu oglądały występ aktorów. Ks. mgr Daniel Adamowicz – Dyrektor Grudziądzkiego Centrum Caritas Ks. mgr Daniel Adamowicz – Dyrektor Grudziądzkiego Centrum Caritas 1. Miejski Ośrodek Pomocy Rodzinie, 86-300 Grudziądz, ul. Waryńskiego 34A 4.      Reklamacja powinna zostać złożona w formie pisemnej. 1. Miejski Ośrodek Pomocy Rodzinie, 86-300 Grudziądz, ul. Waryńskiego 34A

13. Viagra sans ordonnance 24h

15. doxycycline for sale online uk [url=http://doxycyclineotc.store/#]buy doxycycline online[/url] doxycycline 200 mg price

16. Cotización y análisis de las principales critptomonedas en este momento. Bitcoin, Ethereum, Cardano, Solana, Litlecoin y Theter. Con la digitalización acelerada de la economía y los nuevos modos de pago con dispositivos electrónicos, la mayoría de bancos centrales del mundo han anunciado planes para introducir divisas digitales, conocidas como CBDC (por sus siglas en inglés). China fue la primera entre las grandes economías del mundo en comercializar su yuan en formato digital -el e-CNY-, como una manera de competir con las dos grandes plataformas tecnológicas privadas que contabilizan más del 90% de los pagos digitales: Alipay de Alibaba y WeChat Pay de WeChat. En las estafas de inversiones a menudo le prometen que puede “ganar mucho dinero” con “riesgo cero”, y estas estafas suelen comenzar en los medios sociales o en aplicaciones o sitios de citas. Por supuesto que estas estafas también comienzan con un mensaje de texto, email o llamada. Y en las estafas de inversiones, la criptomoneda cumple un rol central de dos maneras: puede ser tanto para una inversión como para pagar.
http://www.andki.co.kr/bbs/board.php?bo_table=free&wr_id=50693

17. A pharmacy that sets the gold standard. https://mexicanpharmonline.shop/# mexico drug stores pharmacies
reputable mexican pharmacies online [url=https://mexicanpharmonline.com/#]mexico online pharmacy[/url] reputable mexican pharmacies online

18. Some are medicines that help people when doctors prescribe. https://mexicanpharmonline.shop/# pharmacies in mexico that ship to usa
mexican mail order pharmacies [url=https://mexicanpharmonline.shop/#]mexico pharmacy price list[/url] mexican border pharmacies shipping to usa

19. Their global network ensures the best medication prices. http://mexicanpharmonline.com/# mexico pharmacies prescription drugs
pharmacies in mexico that ship to usa [url=http://mexicanpharmonline.shop/#]mexican drugstore[/url] mexico drug stores pharmacies

20. sildenafil oral jelly 100mg kamagra [url=http://kamagra.icu/#]buy Kamagra[/url] sildenafil oral jelly 100mg kamagra

21. Tadalafil Tablet [url=http://cialis.foundation/#]Cheap Cialis[/url] Generic Cialis without a doctor prescription

22. Generic Cialis price [url=http://cialis.foundation/#]Buy Cialis online[/url] Generic Cialis without a doctor prescription

23. Tadalafil price [url=https://cialis.foundation/#]cheapest cialis[/url] Cialis without a doctor prescription

24. sildenafil over the counter [url=http://viagra.eus/#]buy Viagra over the counter[/url] Viagra without a doctor prescription Canada

25. Viagra online price [url=https://viagra.eus/#]sildenafil online[/url] Cheap generic Viagra online

26. п»їkamagra [url=http://kamagra.icu/#]Kamagra 100mg price[/url] cheap kamagra

27. Fantastic items from you, man. I’ve take note your stuff previous to and you are simply extremely great.
I really like what you have obtained here, really like what you’re saying and the way in which in which you assert it.

You’re making it entertaining and you continue
to take care of to stay it sensible. I cant wait to
learn far more from you. This is really a wonderful website.

28. mexico drug stores pharmacies: mexican rx online – reputable mexican pharmacies online mexicanpharmacy.company

29. mexican mail order pharmacies: mexico pharmacies prescription drugs – buying prescription drugs in mexico mexicanpharmacy.company
world pharmacy india [url=https://indiapharmacy.pro/#]online shopping pharmacy india[/url] online pharmacy india indiapharmacy.pro

30. mexico pharmacies prescription drugs: mexican rx online – buying prescription drugs in mexico online mexicanpharmacy.company

31. http://propecia.sbs/# buy cheap propecia no prescription
where can i get prednisone over the counter [url=https://prednisone.digital/#]brand prednisone[/url] 50mg prednisone tablet

32. http://propecia.sbs/# cost cheap propecia
amoxicillin 500mg capsule cost [url=https://amoxil.world/#]antibiotic amoxicillin[/url] buy amoxil

33. https://doxycycline.sbs/# order doxycycline 100mg without prescription
cheap generic prednisone [url=https://prednisone.digital/#]prednisone 54899[/url] prednisone 1 tablet

34. http://clomid.sbs/# where can i buy cheap clomid without prescription
generic propecia online [url=http://propecia.sbs/#]cheap propecia[/url] cost cheap propecia for sale

35. http://clomid.sbs/# get cheap clomid without a prescription
amoxicillin cephalexin [url=http://amoxil.world/#]amoxicillin 500 mg price[/url] where to get amoxicillin over the counter

36. http://prednisone.digital/# india buy prednisone online
order doxycycline online [url=http://doxycycline.sbs/#]vibramycin 100 mg[/url] doxycycline 200 mg

37. http://edpills.icu/# best erection pills
mexican online pharmacies prescription drugs [url=https://mexicopharm.shop/#]mexican mail order pharmacies[/url] mexico pharmacies prescription drugs

38. buy research papers online no plagiarism free slot casino world

39. best otc ed pills: ed treatments – п»їerectile dysfunction medication

40. cost for 40 mg lisinopril [url=http://lisinopril.auction/#]buy lisinopril online[/url] prinivil 25mg

41. cipro pharmacy [url=http://ciprofloxacin.men/#]ciprofloxacin without insurance[/url] buy cipro online

42. doxycycline 20 mg coupon [url=http://doxycycline.forum/#]Buy doxycycline for chlamydia[/url] doxycycline cost in mexico

43. zithromax generic price [url=https://azithromycin.bar/#]zithromax antibiotic without prescription[/url] zithromax capsules 250mg

44. doxycycline 40 mg coupon [url=https://doxycycline.forum/#]doxycycline buy online[/url] doxycycline online no prescription

46. These are actually wonderful ideas in about blogging. You have touched some nice things
here. Any way keep up wrinting.

47. It’s a shame you don’t have a donate button! I’d definitely donate to this brilliant blog!
I guess for now i’ll settle for bookmarking and adding your
Talk soon!

48. farmacia barata [url=http://vardenafilo.icu/#]Levitra Bayer[/url] п»їfarmacia online

49. farmacias online baratas [url=https://kamagraes.site/#]kamagra jelly[/url] п»їfarmacia online

50. farmacia online madrid [url=https://vardenafilo.icu/#]Levitra sin receta[/url] farmacia online envГ­o gratis

51. farmacias online seguras en espaГ±a [url=http://vardenafilo.icu/#]Comprar Levitra Sin Receta En Espana[/url] farmacias online baratas

52. farmacia online envГ­o gratis [url=http://vardenafilo.icu/#]Comprar Levitra Sin Receta En Espana[/url] farmacia online internacional

53. farmacia online madrid [url=https://kamagraes.site/#]comprar kamagra[/url] farmacia 24h

54. farmacia online madrid [url=https://farmacia.best/#]mejores farmacias online[/url] farmacia envГ­os internacionales

55. farmacia envГ­os internacionales [url=http://tadalafilo.pro/#]comprar cialis online sin receta[/url] farmacia online 24 horas

56. Pharmacie en ligne France [url=https://pharmacieenligne.guru/#]pharmacie en ligne[/url] Pharmacie en ligne livraison rapide

57. Viagra femme sans ordonnance 24h [url=https://viagrasansordonnance.store/#]Acheter Sildenafil 100mg sans ordonnance[/url] Viagra sans ordonnance 24h Amazon

58. Pharmacie en ligne livraison rapide [url=https://pharmacieenligne.guru/#]Medicaments en ligne livres en 24h[/url] Pharmacie en ligne livraison rapide

59. pharmacie ouverte 24/24: achat kamagra – acheter medicament a l etranger sans ordonnance

60. Pharmacie en ligne livraison rapide [url=https://kamagrafr.icu/#]kamagra pas cher[/url] Pharmacie en ligne livraison rapide

61. Hi colleagues, pleasant paragraph and nice arguments commented here, I am actually enjoying by these.

62. Sight Care is a daily supplement proven in clinical trials and conclusive science to improve vision by nourishing the body from within. The Sight Care formula claims to reverse issues in eyesight, and every ingredient is completely natural.

63. Cortexi is a completely natural product that promotes healthy hearing, improves memory, and sharpens mental clarity. Cortexi hearing support formula is a combination of high-quality natural components that work together to offer you with a variety of health advantages, particularly for persons in their middle and late years. Cortex not only improves hearing but also decreases inflammation, eliminates brain fog, and gives natural memory protection.

64. Boostaro increases blood flow to the reproductive organs, leading to stronger and more vibrant erections. It provides a powerful boost that can make you feel like you’ve unlocked the secret to firm erections

65. Puravive introduced an innovative approach to weight loss and management that set it apart from other supplements. It enhances the production and storage of brown fat in the body, a stark contrast to the unhealthy white fat that contributes to obesity.

66. Neotonics is an essential probiotic supplement that works to support the microbiome in the gut and also works as an anti-aging formula. The formula targets the cause of the aging of the skin.

67. EyeFortin is a natural vision support formula crafted with a blend of plant-based compounds and essential minerals. It aims to enhance vision clarity, focus, and moisture balance.

68. The Quietum Plus supplement promotes healthy ears, enables clearer hearing, and combats tinnitus by utilizing only the purest natural ingredients. Supplements are widely used for various reasons, including boosting energy, lowering blood pressure, and boosting metabolism.

69. GlucoBerry is one of the biggest all-natural dietary and biggest scientific breakthrough formulas ever in the health industry today. This is all because of its amazing high-quality cutting-edge formula that helps treat high blood sugar levels very naturally and effectively.

70. Kerassentials are natural skin care products with ingredients such as vitamins and plants that help support good health and prevent the appearance of aging skin. They’re also 100% natural and safe to use. The manufacturer states that the product has no negative side effects and is safe to take on a daily basis. Kerassentials is a convenient, easy-to-use formula.

71. ProDentim is a nutritional dental health supplement that is formulated to reverse serious dental issues and to help maintain good dental health.

72. Endo Pump Male Enhancement is a dietary supplement designed to assist men improve their sexual performance. This natural formula contains a potent blend of herbs and nutrients that work together to improve blood flow

73. Dentitox Pro is a liquid dietary solution created as a serum to support healthy gums and teeth. Dentitox Pro formula is made in the best natural way with unique, powerful botanical ingredients that can support healthy teeth.

74. Nervogen Pro, A Cutting-Edge Supplement Dedicated To Enhancing Nerve Health And Providing Natural Relief From Discomfort. Our Mission Is To Empower You To Lead A Life Free From The Limitations Of Nerve-Related Challenges. With A Focus On Premium Ingredients And Scientific Expertise.

75. Glucofort Blood Sugar Support is an all-natural dietary formula that works to support healthy blood sugar levels. It also supports glucose metabolism. According to the manufacturer, this supplement can help users keep their blood sugar levels healthy and within a normal range with herbs, vitamins, plant extracts, and other natural ingredients.

76. Buy discount supplements, vitamins, health supplements, probiotic supplements. Save on top vitamin and supplement brands.

77. Thankful, I’ve reached this milestone with this riveting book, heartfelt thanks to the author!

78. Congratulations on your incredible gift for writing! Your article is an engaging and enlightening read. Wishing you a New Year full of achievements and happiness!

79. Exquisite writing! I’m a writer as well and would love the opportunity to contribute

80. The piece was well-researched. Including more visual content could make it even better, and my website might have the resources you need.

81. Good job on the article. Visual content can make it more engaging, and my website might offer some insights for that.

82. Loved every word! Is there room for one more writer on the team?

83. Does anyone have info on whether the author is still blogging? We need more posts on this topic!

84. Brilliant work! The article is insightful and well-detailed. Adding more visuals in your future articles could make them even more enjoyable for readers.

85. Your content is fantastic! 🚀 The information presented is both valuable and well-articulated. How about sprinkling in more visuals in future articles for an even more delightful read? 📸