{"id":17146169,"url":"https://github.com/drew2a/intask","last_synced_at":"2025-03-24T10:25:47.117Z","repository":{"id":106393997,"uuid":"107506824","full_name":"drew2a/InTask","owner":"drew2a","description":"Implementation of a several programming tasks from technical interviews","archived":false,"fork":false,"pushed_at":"2019-10-05T08:00:26.000Z","size":191,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T15:50:41.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/drew2a.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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":"2017-10-19T06:28:57.000Z","updated_at":"2020-09-25T21:22:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"f78de0ee-d788-4575-8f23-88943725eed3","html_url":"https://github.com/drew2a/InTask","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drew2a%2FInTask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drew2a%2FInTask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drew2a%2FInTask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drew2a%2FInTask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drew2a","download_url":"https://codeload.github.com/drew2a/InTask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245250932,"owners_count":20584798,"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":[],"created_at":"2024-10-14T21:08:00.263Z","updated_at":"2025-03-24T10:25:47.097Z","avatar_url":"https://github.com/drew2a.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Summary\nMy implementation of a several programming tasks from interview.\n\nAll examples: [main.py](main.py)\n\n## Installation:\n\n```bash\npip install -r requirements.txt\n```\n\n## Tasks\n\n### Matrices\n\n##### Spiral/snail matrix\n\nExample of how to create matrix like this: \u003cbr\u003e\n9 8 7 \u003cbr\u003e\n2 1 6 \u003cbr\u003e\n3 4 5 \n```python\n# size = 5\n# answer:\n# 25    24    23    22    21  \n# 10     9     8     7    20  \n# 11     2     1     6    19  \n# 12     3     4     5    18  \n# 13    14    15    16    17 \ndef create_snail_matrix(size):\n```\n\u003cbr\u003eSource: [matrix_problems.py](data_structure/problem/matrix/matrix_problems.py)\n\n##### Spiral/snail Matrix Sorting\n\nGiven an NxN array, write a function that will return an array where they are \nsorted such that you spiral clockwise inward:\n\n```python\n# Given:\n# 16     4     5     4     6\n#  4    18    20     5    10\n# 20     2     2     1    19\n#  3     3     4     6    15\n# 20     8    14    20    13\n# \n# Result:\n#  1     2     2     3     3\n# 13    14    15    16     4\n# 10    20    20    18     4\n#  8    20    20    19     4\n#  6     6     5     5     4  \ndef sort_snail_matrix(matrix):\n```\n\u003cbr\u003eSource: [matrix_problems.py](data_structure/problem/matrix/matrix_problems.py)\n\n### Arrays\n\n#### Google problem with bars:\n\nHow many water given bars will collect?\n```python\n# array = [1, 2, 0, 1, 3, 1]\n# answer: 3\n#\n#|  |  |  |  |oo|  |\n#|  |oo|~~|~~|oo|  |\n#|oo|oo|~~|oo|oo|oo|\n#  0  1  2  3  4  5 \n\ndef find_water_count(array):\n```\n\u003cbr\u003eSource: [array_problems.py](data_structure/problem/array/array_problems.py)\n\n#### Bolt problem with fountains:\nWhat min numbers of fountains should be opened, for filling whole lawn:\n\n```python\n#    --- .... ------   ------..\n# \\|/   /    \\      \\|/ \\\n# [3, 1, 1, 2, 1, 0, 4, 0, 0, 3]\n# Result 2\ndef found_min_required_fountains(a):\n```\n\u003cbr\u003eSource: [fountain.py](data_structure/problem/array/fountain.py)\n\n#### Pairs\n\nFind a pair of elements from an array whose sum equals a given number:\n\n```python\n# array = [8, 0, 6, 6, 9, 4, 1, 4, 9, 3, 9, 1, 0, 4, 2, 6, 5, 7, 5, 6]\n# value = 10\n# answer: [(4, 6), (9, 1), (5, 5), (6, 4)]\ndef find_pairs(array, value):\n```\n\n\u003cbr\u003eSource: [array_problems.py](data_structure/problem/array/array_problems.py)\n\n#### Left rotation\n\nExample of a left rotation operation on an array: \n\n```python\n# a = [1, 2, 3, 4, 5]\n# k = 2\n# answer: [3, 4, 5, 1, 2]\ndef array_left_rotation(a, k):\n```\n\n\u003cbr\u003eSource: [array_problems.py](data_structure/problem/array/array_problems.py)\n\n#### Sub array with max sum\n\nHow to find sub array with max sum: \n\n```python\n# given array = [1, 2, -2, -3, 0, 0, 9, -1, 5, 2]\n# answer: [9, -1, 5, 2]\ndef max_sum_sub_array(given_array):\n```\n\n\u003cbr\u003eSource: [array_problems.py](data_structure/problem/array/array_problems.py)\n\n### Sequences\n#### Print numbers can be divided by 3 and can not be divided by 5...\n\nExample how to find numbers can be divided by 3 and can not be divided by 5.\nSum of all digits in each number is less than 10.\n\n\n```python\n# n=40\n# answer: [3, 6, 9, 12, 18, 21, 24, 27, 33, 36]\ndef create_3_5_10_array(n):\n```\n\n\u003cbr\u003eSource: [sequence_problems.py](data_structure/problem/sequence/sequence_problems.py)\n\n#### Find primes\n\nExample how to find prime numbers with the sieve of eratosthenes:\n\n```python\n# n=50\n# sort=True\n# answer: [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\ndef sieve_of_eratosthenes(n, sort=False):\n```\n\u003cbr\u003eSource: [sequence_problems.py](data_structure/problem/sequence/sequence_problems.py)\n\n\n### Trees\n#### Binary search tree\n\nCheck is this a binary search tree:\n\n```python\n# root = 8(4(2(1(None, None), 3(None, None)), 6(None, None)), 13(10(None, None), 14(None, None)))\n# answer: True\ndef check_binary_search_tree(root):\n```\n\u003cbr\u003eSource: [tree_problems.py](data_structure/problem/tree/tree_problems.py)\n\n#### Lowest common ancestor\n\nExample of finding a lowest common ancestor:\n\n```python\n# root = 8(4(2(1(None, None), 3(None, None)), 6(None, None)), 13(10(None, None), 14(None, None)))\n# a: 6\n# b: 1\n# answer: 4\ndef get_lowest_common_ancestor(root, a, b):\n```\n\n\u003cbr\u003eSource: [tree_problems.py](data_structure/problem/tree/tree_problems.py)\n\n\n### Strings\n#### Anagram\n\nCheck for anagrams (case sensitive)\n\n```python\n# s1 = one\n# s2 = eon\n# answer: True\ndef check(s1, s2):\n```\n\n\u003cbr\u003eSource: [string_problems.py](data_structure/problem/string/string_problems.py)\n\n#### Find first not recurring character\n\n```python\n# s = ABACDBCEAB\n# answer: D\ndef find_first_not_recurring_character(s):\n```\n\n\u003cbr\u003eSource: [string_problems.py](data_structure/problem/string/string_problems.py)\n\n#### Screenshot\n\n![screenshot](screenshot.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrew2a%2Fintask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrew2a%2Fintask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrew2a%2Fintask/lists"}