8000 Java-Hackerrank-Solutions/30DaysOfCode/Day14.java at main · Manush54/Java-Hackerrank-Solutions · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"30DaysOfCode":{"items":[{"name":"Day00.java","path":"30DaysOfCode/Day00.java","contentType":"file"},{"name":"Day01.java","path":"30DaysOfCode/Day01.java","contentType":"file"},{"name":"Day02.java","path":"30DaysOfCode/Day02.java","contentType":"file"},{"name":"Day03.java","path":"30DaysOfCode/Day03.java","contentType":"file"},{"name":"Day04.java","path":"30DaysOfCode/Day04.java","contentType":"file"},{"name":"Day05.java","path":"30DaysOfCode/Day05.java","contentType":"file"},{"name":"Day06.java","path":"30DaysOfCode/Day06.java","contentType":"file"},{"name":"Day07.java","path":"30DaysOfCode/Day07.java","contentType":"file"},{"name":"Day08.java","path":"30DaysOfCode/Day08.java","contentType":"file"},{"name":"Day09.java","path":"30DaysOfCode/Day09.java","contentType":"file"},{"name":"Day10.java","path":"30DaysOfCode/Day10.java","contentType":"file"},{"name":"Day11.java","path":"30DaysOfCode/Day11.java","contentType":"file"},{"name":"Day12.java","path":"30DaysOfCode/Day12.java","contentType":"file"},{"name":"Day13.java","path":"30DaysOfCode/Day13.java","contentType":"file"},{"name":"Day14.java","path":"30DaysOfCode/Day14.java","contentType":"file"},{"name":"Day15.java","path":"30DaysOfCode/Day15.java","contentType":"file"},{"name":"Day16.java","path":"30DaysOfCode/Day16.java","contentType":"file"},{"name":"Day17.java","path":"30DaysOfCode/Day17.java","contentType":"file"},{"name":"Day18.java","path":"30DaysOfCode/Day18.java","contentType":"file"},{"name":"Day19.java","path":"30DaysOfCode/Day19.java","contentType":"file"},{"name":"Day20.java","path":"30DaysOfCode/Day20.java","contentType":"file"},{"name":"Day21.java","path":"30DaysOfCode/Day21.java","contentType":"file"},{"name":"Day22.java","path":"30DaysOfCode/Day22.java","contentType":"file"},{"name":"Day23.java","path":"30DaysOfCode/Day23.java","contentType":"file"},{"name":"Day24.java","path":"30DaysOfCode/Day24.java","contentType":"file"},{"name":"Day25.java","path":"30DaysOfCode/Day25.java","contentType":"file"},{"name":"Day26.java","path":"30DaysOfCode/Day26.java","contentType":"file"},{"name":"Day27.java","path":"30DaysOfCode/Day27.java","contentType":"file"},{"name":"Day28.java","path":"30DaysOfCode/Day28.java","contentType":"file"},{"name":"Day29.java","path":"30DaysOfCode/Day29.java","contentType":"file"}],"totalCount":30},"":{"items":[{"name":".vscode","path":".vscode","contentType":"directory"},{"name":"30DaysOfCode","path":"30DaysOfCode","contentType":"directory"},{"name":"Java","path":"Java","contentType":"directory"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":4}},"fileTreeProcessingTime":5.260199,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":386222627,"defaultBranch":"main","name":"Java-Hackerrank-Solutions","ownerLogin":"Manush54","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2021-07-15T08:43:18.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/61927733?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1626338599.486494","canEdit":false,"refType":"branch","currentOid":"a0568568d61d335cc017de6438784d0c72986de1"},"path":"30DaysOfCode/Day14.java","currentUser":null,"blob":{"rawLines":["import java.util.*;","","class Difference {"," \tprivate int[] elements;"," \tpublic int maximumDifference;","","\t// Add your code here"," Difference(int[] a){"," elements = a;"," }"," void computeDifference(){"," for (int element1 : elements){"," for (int element2 : elements){"," if(Math.abs(element1 - element2) \u003e maximumDifference){"," maximumDifference = Math.abs(element1 - element2);"," }"," }"," }"," }","","} // End of Difference class","","public class Day14 {",""," public static void main(String[] args) {"," Scanner sc = new Scanner(System.in);"," int n = sc.nextInt();"," int[] a = new int[n];"," for (int i = 0; i \u003c n; i++) {"," a[i] = sc.nextInt();"," }"," sc.close();",""," Difference difference = new Difference(a);",""," difference.computeDifference();",""," System.out.print(difference.maximumDifference);"," }","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Manush54/Java-Hackerrank-Solutions/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"Day14.java","displayUrl":"https://github.com/Manush54/Java-Hackerrank-Solutions/blob/main/30DaysOfCode/Day14.java?raw=true","headerInfo":{"blobSize":"933 Bytes","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"9218e67","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FManush54%2FJava-Hackerrank-Solutions%2Fblob%2Fmain%2F30DaysOfCode%2FDay14.java","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"40","truncatedSloc":"32"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Java","languageID":181,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Manush54/Java-Hackerrank-Solutions/blob/main/30DaysOfCode/Day14.java","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/Manush54/Java-Hackerrank-Solutions/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/Manush54/Java-Hackerrank-Solutions/raw/refs/heads/main/30DaysOfCode/Day14.java","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/Manush54/Java-Hackerrank-Solutions/branches":{"post":"coveXYP44yBR1mpRSVpNVGIbP_d6K8LfQgN6PcVs7rKaN-mGXNwsw68bxRsnYiWFSewHF9prEd_sAq97v0leUQ"},"/repos/preferences":{"post":"DEmeHH5lcvsed8m8kx57DX6Y24nsOfP0eHtAc4CgFFdOiffS-kz_mcH9SzoxjM6ykCioNABltNLX3WytWzw_yg"}}},"title":"Java-Hackerrank-Solutions/30DaysOfCode/Day14.java at main · Manush54/Java-Hackerrank-Solutions","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-b84e9496fc59.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0