|
9133 | 9133 | },
|
9134 | 9134 | {
|
9135 | 9135 | "cell_type": "code",
|
9136 |
| - "execution_count": 114, |
| 9136 | + "execution_count": 49, |
9137 | 9137 | "metadata": {},
|
9138 | 9138 | "outputs": [
|
9139 | 9139 | {
|
9140 | 9140 | "name": "stdout",
|
9141 | 9141 | "output_type": "stream",
|
9142 | 9142 | "text": [
|
9143 |
| - "i am offline and i have to wait till the internet connection is back!\n" |
| 9143 | + "999\n", |
| 9144 | + "not Continuous\n" |
9144 | 9145 | ]
|
9145 | 9146 | }
|
9146 | 9147 | ],
|
|
9150 | 9151 | "# --- HARD HARD HARD ---\n",
|
9151 | 9152 | "\n",
|
9152 | 9153 | "\n",
|
9153 |
| - "print(\"i am offline and i have to wait till the internet connection is back!\")\n", |
| 9154 | + "# print(\"i am offline and i have to wait till the internet connection is back!\")\n", |
9154 | 9155 | "\n",
|
9155 | 9156 | "nums = [1,10,100,1000]\n",
|
9156 |
| - "\n" |
| 9157 | + "# nums = [1,2,3,5,6]\n", |
| 9158 | + "# nums = [4,2,5,3]\n", |
| 9159 | + "\n", |
| 9160 | + "nums.sort()\n", |
| 9161 | + "\n", |
| 9162 | + "max_diff = max(nums) - min(nums)\n", |
| 9163 | + "\n", |
| 9164 | + "print(max_diff)\n", |
| 9165 | + "if max_diff == len(nums)-1 and len(nums) == len(set(nums)): \n", |
| 9166 | + " print('Continuous')\n", |
| 9167 | + "else: \n", |
| 9168 | + " print('not Continuous')\n" |
| 9169 | + ] |
| 9170 | + }, |
| 9171 | + { |
| 9172 | + "cell_type": "code", |
| 9173 | + "execution_count": 50, |
| 9174 | + "metadata": {}, |
| 9175 | + "outputs": [ |
| 9176 | + { |
| 9177 | + "name": "stdout", |
| 9178 | + "output_type": "stream", |
| 9179 | + "text": [ |
| 9180 | + "[11, 25, 66, 1, 69, 7]\n", |
| 9181 | + "[23, 55, 17, 45, 15, 52]\n", |
| 9182 | + "[75, 31, 36, 44, 58, 8]\n", |
| 9183 | + "[22, 27, 33, 25, 68, 4]\n", |
| 9184 | + "[84, 28, 14, 11, 5, 50]\n" |
| 9185 | + ] |
| 9186 | + } |
| 9187 | + ], |
| 9188 | + "source": [ |
| 9189 | + "# 1329 : https://leetcode.com/problems/sort-the-matrix-diagonally/\n", |
| 9190 | + "\n", |
| 9191 | + "mat = [[11,25,66,1,69,7],[23,55,17,45,15,52],[75,31,36,44,58,8],[22,27,33,25,68,4],[84,28,14,11,5,50]]\n", |
| 9192 | + "\n", |
| 9193 | + "for val in mat: \n", |
| 9194 | + " print(val)" |
9157 | 9195 | ]
|
9158 | 9196 | },
|
9159 | 9197 | {
|
|
0 commit comments