{"id":21698536,"url":"https://github.com/luizfelipelopes/diagonaldifference","last_synced_at":"2025-03-20T15:21:42.885Z","repository":{"id":224834949,"uuid":"764352325","full_name":"luizfelipelopes/diagonalDifference","owner":"luizfelipelopes","description":"Diagonal Difference (Problem resolved in Hacker Rank)","archived":false,"fork":false,"pushed_at":"2024-02-27T23:47:13.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T14:28:39.959Z","etag":null,"topics":["algorithm","algorithm-challenges","algorithms","algorithms-and-data-structures","hackerrank","hackerrank-solutions","javascript"],"latest_commit_sha":null,"homepage":"https://stackblitz.com/edit/vitejs-vite-1jdcnn","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luizfelipelopes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-27T23:20:17.000Z","updated_at":"2024-02-27T23:51:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5a2a5d4-b49a-4a95-998f-3080d5491102","html_url":"https://github.com/luizfelipelopes/diagonalDifference","commit_stats":null,"previous_names":["luizfelipelopes/diagonaldifference"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizfelipelopes%2FdiagonalDifference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizfelipelopes%2FdiagonalDifference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizfelipelopes%2FdiagonalDifference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizfelipelopes%2FdiagonalDifference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luizfelipelopes","download_url":"https://codeload.github.com/luizfelipelopes/diagonalDifference/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244637181,"owners_count":20485455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithm-challenges","algorithms","algorithms-and-data-structures","hackerrank","hackerrank-solutions","javascript"],"created_at":"2024-11-25T19:34:57.991Z","updated_at":"2025-03-20T15:21:42.866Z","avatar_url":"https://github.com/luizfelipelopes.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diagonal Difference\n\nGiven a square matrix, calculate the absolute difference between the sums of its diagonals.\n\nFor example, the square matrix  is shown below:\n\n```\n1 2 3\n4 5 6\n9 8 9  \n```\n\nThe left-to-right diagonal = *1 + 5 + 9 = 15*. The right to left diagonal = 3 + 5 + 9 = 17. Their absolute difference is *|15 - 17| = 2*.\n\n### Function description\n\nComplete the ***diagonalDifference*** function in the editor below.\n\ndiagonalDifference takes the following parameter:\n\n* int arr[n][m]: an array of integers\n\n### Return\n\n* int: the absolute diagonal difference\n\n### Constraints\n\n***-100 \u003c= arr[i] \u003c= 100***\n\n### Output Format\n\nReturn the absolute difference between the sums of the matrix's two diagonals as a single integer.\n\n### Sample Input\n\n```\n11 2  4\n4  5  6\n10 8 -12\n```\n\n### Sample Output\n```\n15\n```\n\n### Explanation\n\nThe primary diagonal is:\n```\n11\n   5\n     -12\n```\nSum across the primary diagonal: *11 + 5 - 12 = 4*\n\nThe secondary diagonal is:\n```\n     4\n   5\n10\n```\nSum across the secondary diagonal: *4 + 5 + 10 = 19*\n\nDifference: *|4 - 19| = 15*\n\n**Note:** |x| is the absolute value of x\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizfelipelopes%2Fdiagonaldifference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluizfelipelopes%2Fdiagonaldifference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizfelipelopes%2Fdiagonaldifference/lists"}