{"id":24021210,"url":"https://github.com/zipcodecore/duplicatedeleter","last_synced_at":"2025-08-14T07:43:58.573Z","repository":{"id":29262345,"uuid":"119426536","full_name":"ZipCodeCore/DuplicateDeleter","owner":"ZipCodeCore","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-10T00:35:17.000Z","size":15,"stargazers_count":0,"open_issues_count":42,"forks_count":24,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-15T21:16:53.950Z","etag":null,"topics":["corejava","corejava-chapter3","corejava-chapter3-section10","corejava-chapter3-section8"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/ZipCodeCore.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}},"created_at":"2018-01-29T18:57:37.000Z","updated_at":"2022-10-14T16:18:26.000Z","dependencies_parsed_at":"2022-07-17T02:16:09.563Z","dependency_job_id":null,"html_url":"https://github.com/ZipCodeCore/DuplicateDeleter","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDuplicateDeleter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDuplicateDeleter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDuplicateDeleter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDuplicateDeleter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/DuplicateDeleter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153951,"owners_count":21221330,"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":["corejava","corejava-chapter3","corejava-chapter3-section10","corejava-chapter3-section8"],"created_at":"2025-01-08T12:40:00.500Z","updated_at":"2025-04-15T21:17:00.751Z","avatar_url":"https://github.com/ZipCodeCore.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Delete Duplicates \n* **Objective**\n\t* To write methods which remove duplicate elements from an array.\n* **Purpose**\n\t* To demonstrate practical understanding of arrays, loops, and basic composition.\n* **Instructions**\n    * Given an object, `IntegerDuplicateDeleter`, with a composite `Integer[]` object, write a method\n        * `removeDuplicatesExactly` which removes all values in the array which occur exactly the specified number of times.\n        * `removeDuplicates` which removes all values in the array which occur at least the specified number of times.\n\t\u003cbr\u003e\u003cbr\u003e\n    * Given an object, `StringDuplicateDeleter`, with a composite `String[]` object, write a method\n        * `removeDuplicatesExactly` which removes all values in the array which occur exactly the specified number of times.\n        * `removeDuplicates` which removes all values in the array which occur at least the specified number of times.\n\n* **Restrictions**\n    * No use of any built-in data structures, (`Collection`, `List`, `Map`)\n    * Operations should be [idempotent](https://stackoverflow.com/questions/1077412/what-is-an-idempotent-operation)\n        * If the input is the same, then the outputs of the methods should **always** be the same, regardless of how many times the method is called.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## `removeDuplicateExactly(n)`\n\n### Example 1\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicateExactly(3);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n* Sample Output\n\n    ```\n    [23,23,56,57,58]\n    ```\n    \n    \n    \n\n### Example 2\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicateExactly(1);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n* Sample Output\n\n    ```\n    [1,1,1,23,23]\n    ```\n    \n    \n    \n\n### Example 3\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicateExactly(3);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n* Sample Output\n\n    ```\n    [1, 1, 2, 4, 4, 5, 5, 5, 5]\n    ```\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## `removeDuplicates(n)`\n\n### Example 1\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicateExactly(1);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n\n\n* Sample Output\n\n    ```\n    []\n    ```\n\n\n\n\n### Example 2\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicates(2);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n\n\n* Sample Output\n\n    ```\n    [2]\n    ```\n\n\n\n### Example 3\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicates(3);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n\n\n* Sample Output\n\n    ```\n    [1,1,2,4,4]\n    ```\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Idempotence\n\n### Example 1\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    deleter.removeDuplicates(0);\n    deleter.removeDuplicates(1);\n    deleter.removeDuplicates(2);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicates(3);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n\n\n* Sample Output\n\n    ```\n    [1,1,2,4,4]\n    ```\n    \n\n### Example 2\n* Sample Script\n\n    ```\n    // : Given\n    Integer[] array = new Integer[]{1,1,1,23,23,56,57,58};\n    DuplicateDeleter\u003cInteger\u003e deleter = new IntegerDuplicateDeleter(array);\n    deleter.removeDuplicates(0);\n    deleter.removeDuplicates(1);\n    deleter.removeDuplicates(2);\n    \n    // : When\n    Integer[] actual = deleter.removeDuplicatesExactly(3);\n    \n    // : Then\n    System.out.println(Arrays.toString(actual));\n    ```\n\n\n\n* Sample Output\n\n    ```\n    [23,23,56,57,58]\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fduplicatedeleter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fduplicatedeleter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fduplicatedeleter/lists"}