Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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.##

Expand Down
79 changes: 77 additions & 2 deletions test.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down