From 2f461a2edb47077210cea907a8c6dc2df10ebb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=80=9D=E5=87=A1?= <2842824394@qq.com> Date: Fri, 22 Dec 2023 08:20:44 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fixed=202033338=20from=20https://gitee.com/?= =?UTF-8?q?msf24/data=5Fstructure/pulls/1304=20add=202209040024/=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E8=BF=9E=E7=BB=AD1=E7=9A=84=E4=B8=AA=E6=95=B0.cpp.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马思凡 <2842824394@qq.com> --- ...3\2551\347\232\204\344\270\252\346\225\260.cpp" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "2209040024/\346\234\200\345\244\247\350\277\236\347\273\2551\347\232\204\344\270\252\346\225\260.cpp" diff --git "a/2209040024/\346\234\200\345\244\247\350\277\236\347\273\2551\347\232\204\344\270\252\346\225\260.cpp" "b/2209040024/\346\234\200\345\244\247\350\277\236\347\273\2551\347\232\204\344\270\252\346\225\260.cpp" new file mode 100644 index 00000000..fdfcdbb0 --- /dev/null +++ "b/2209040024/\346\234\200\345\244\247\350\277\236\347\273\2551\347\232\204\344\270\252\346\225\260.cpp" @@ -0,0 +1,14 @@ +int longestOnes(vector& A, int K) { + int left = 0, right = 0; + int k = K; + while(right < A.size()) { + if((A[right++] == 0)) + k--; + if(k < 0) { + if(A[left] == 0) + k++; + left++; + } + } + return right - left; +} -- Gitee From 3dd421bae04d427ad18ca9b141e7e5f186da3060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=80=9D=E5=87=A1?= <2842824394@qq.com> Date: Fri, 22 Dec 2023 08:19:40 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fixed=205230972=20from=20https://gitee.com/?= =?UTF-8?q?msf24/data=5Fstructure/pulls/1304=20add=202209040024/=E9=87=8D?= =?UTF-8?q?=E5=A1=91=E7=9F=A9=E9=98=B5.cpp.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马思凡 <2842824394@qq.com> --- ...5\345\241\221\347\237\251\351\230\265.cpp" | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 "2209040024/\351\207\215\345\241\221\347\237\251\351\230\265.cpp" diff --git "a/2209040024/\351\207\215\345\241\221\347\237\251\351\230\265.cpp" "b/2209040024/\351\207\215\345\241\221\347\237\251\351\230\265.cpp" new file mode 100644 index 00000000..fb8002fa --- /dev/null +++ "b/2209040024/\351\207\215\345\241\221\347\237\251\351\230\265.cpp" @@ -0,0 +1,49 @@ +class Solution { + public int[][] matrixReshape(int[][] nums, int r, int c) { + int row=nums.length; + int col=nums[0].length; + if(row*col!=r*c) + { + return nums; + } + int ans[][]=new int[r][c]; + int m=0; + int n=0; + for(int i=0;ir) + { + if(n