diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 96f7e1c..83ca47b --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # test_git Learn how to use git properly -# ANNA update after Main branch protection +# KAI update after Main branch protection + + ## Please be freindly to Bigginer.## diff --git a/test.ipynb b/test.ipynb old mode 100644 new mode 100755 index 50e5485..0098735 --- a/test.ipynb +++ b/test.ipynb @@ -5,13 +5,88 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "JUST FOR TEST" + "75.\n", + "\n", + "Given an array `nums` with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.\n", + "\n", + "We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively.\n", + "\n", + "You must solve this problem without using the library's sort function.\n", + "\n", + " \n", + "\n", + "Example 1:\n", + "\n", + "Input: nums = $[2,0,2,1,1,0]$\n", + "Output: [0,0,1,1,2,2]\n", + "Example 2:\n", + "\n", + "Input: nums = [2,0,1]\n", + "Output: [0,1,2]\n", + " \n", + "\n", + "Constraints:\n", + "\n", + "n == nums.length\n", + "1 <= n <= 300\n", + "nums[i] is either 0, 1, or 2.\n", + " \n", + "\n", + "Follow up: Could you come up with a one-pass algorithm using only constant extra space?" ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "class Solution(object):\n", + " def sortColors(self, nums):\n", + " \"\"\"\n", + " :type nums: List[int]\n", + " :rtype: None Do not return anything, modify nums in-place instead.\n", + " \"\"\"\n", + " low, mid, high = 0, 0, len(nums) - 1\n", + " \n", + " while mid <= high:\n", + " if nums[mid] == 0:\n", + " nums[low], nums[mid] = nums[mid], nums[low]\n", + " low += 1\n", + " mid += 1\n", + " elif nums[mid] == 1:\n", + " mid += 1\n", + " else:\n", + " nums[mid], nums[high] = nums[high], nums[mid]\n", + " high -= 1\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { + "kernelspec": { + "display_name": "py310", + "language": "python", + "name": "python3" + }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" }, "orig_nbformat": 4 },