FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 3483,3 "name": "alternating_groups_ii",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/alternating-groups-ii/",6 "date": "2024-06-22 00:00:00",7 "task_description": "There is a circle of red and blue tiles. You are given an array of integers `colors` and an integer `k`. The color of tile `i` is represented by `colors[i]`: `colors[i] == 0` means that tile `i` is **red**. `colors[i] == 1` means that tile `i` is **blue**. An **alternating** group is every `k` contiguous tiles in the circle with **alternating** colors (each tile in the group except the first and last one has a different color from its **left** and **right** tiles). Return the number of **alternating** groups. **Note** that since `colors` represents a **circle**, the **first** and the **last** tiles are considered to be next to each other. **Example 1:** **Input:** colors = [0,1,0,1,0], k = 3 **Output:** 3 **Explanation:** **** Alternating groups: **Example 2:** **Input:** colors = [0,1,0,0,1,0,1], k = 6 **Output:** 2 **Explanation:** **** Alternating groups: **Example 3:** **Input:** colors = [1,1,0,1], k = 4 **Output:** 0 **Explanation:** **Constraints:** `3 <= colors.length <= 105` `0 <= colors[i] <= 1` `3 <= k <= colors.length`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "colors = [0,1,0,1,0], k = 3",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "colors = [0,1,0,0,1,0,1], k = 6",17 "output": "2 "18 },19 {20 "label": "Example 3",21 "input": "colors = [1,1,0,1], k = 4",22 "output": "0 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 [29 0,30 0,31 1,32 0,33 0,34 1,35 0,36 1,37 1,38 1,39 0,40 0,41 1,42 0,43 0,44 1,45 1,46 1,47 0,48 1,49 1,50 0,51 0,52 0,53 0,54 0,55 1,56 1,57 0,58 0,59 0,60 1,61 1,62 0,63 0,64 0,65 0,66 0,67 1,68 1,69 1,70 1,71 0,72 1,73 0,74 1,75 0,76 0,77 1,78 0,79 1,80 1,81 1,82 1,83 1,84 0,85 0,86 1,87 0,88 1,89 1,90 1,91 0,92 0,93 1,94 0,95 0,96 1,97 0,98 0,99 1,100 0,101 0,102 1,103 0,104 0,105 0,106 1,107 1,108 0,109 1,110 1,111 1,112 1,113 1,114 1,115 1,116 1,117 1,118 1,119 0,120 0,121 0,122 0,123 1,124 1,125 0,126 0,127 0,128 0,129 0,130 1,131 0,132 1,133 0,134 0,135 0,136 0,137 0,138 0,139 0,140 1,141 0,142 1,143 0,144 1,145 0,146 1,147 1,148 1,149 0,150 1,151 1,152 1,153 0,154 1,155 0,156 0,157 0,158 0,159 1,160 0,161 0,162 1,163 1,164 0,165 0,166 1,167 1,168 1,169 0,170 0,171 1,172 0,173 1,174 0,175 0,176 1,177 0,178 0,179 0,180 0,181 1,182 0,183 0,184 0,185 0,186 0,187 1,188 1,189 1,190 0,191 0,192 0,193 0,194 0,195 0,196 0,197 1,198 0,199 1,200 1,201 0,202 1,203 0,204 1,205 0,206 0,207 1,208 0,209 1,210 0,211 0,212 1,213 0,214 0,215 1,216 0,217 0,218 0,219 0,220 0,221 0,222 1,223 1,224 1,225 1,226 0,227 0,228 1,229 1,230 0,231 0,232 1,233 1,234 0,235 0,236 1,237 1,238 0,239 1,240 0,241 0,242 1,243 0,244 1,245 0,246 1,247 1,248 0,249 0,250 1,251 1,252 0,253 0,254 1,255 0,256 1,257 1,258 0,259 0,260 1,261 0,262 1,263 1,264 1,265 0,266 0,267 1,268 0,269 1,270 1,271 0,272 1,273 1,274 1,275 1,276 0,277 1,278 1,279 0,280 0,281 0,282 0,283 1,284 0,285 0,286 1,287 0,288 1,289 1,290 1,291 0,292 1,293 0,294 1,295 0,296 0,297 1,298 0,299 0,300 1,301 0,302 1,303 1,304 1,305 0,306 0,307 1,308 0,309 1,310 0,311 0,312 0,313 0,314 0,315 1,316 1,317 1,318 0,319 0,320 1,321 0,322 0,323 0,324 1,325 1,326 0,327 1,328 1,329 1,330 0,331 1,332 1,333 1,334 1,335 0,336 0,337 1,338 1,339 1,340 1,341 1,342 1,343 1,344 1,345 0,346 0,347 1,348 1,349 0,350 1,351 1,352 0,353 1,354 0,355 0,356 1,357 0,358 0,359 1,360 0,361 0,362 0,363 0,364 0,365 1,366 1,367 0,368 0,369 0,370 0,371 1,372 0,373 0,374 1,375 1,376 0,377 1,378 1,379 0,380 1,381 1,382 1,383 1,384 0,385 0,386 1,387 1,388 1,389 0,390 1,391 1,392 1,393 0,394 0,395 1,396 0,397 1,398 0,399 0,400 0,401 0,402 0,403 1,404 0,405 0,406 1,407 0,408 0,409 0,410 0,411 1,412 0,413 1,414 0,415 0,416 0,417 0,418 1,419 1,420 0,421 1,422 1,423 0,424 1,425 1,426 1,427 0,428 0,429 0,430 1,431 0,432 1,433 1,434 1,435 1,436 0,437 0,438 0,439 0,440 0,441 0,442 0,443 0,444 1,445 0,446 1,447 1,448 0,449 0,450 1,451 0,452 1,453 1,454 1,455 1,456 1,457 1,458 1,459 0,460 1,461 0,462 0,463 1,464 0,465 1,466 1,467 1,468 1,469 1,470 1,471 1,472 1,473 1,474 1,475 0,476 1,477 1,478 0,479 1,480 0,481 0,482 1,483 1,484 1,485 1,486 1,487 1,488 1,489 0,490 0,491 1,492 0,493 1,494 0,495 1,496 1,497 1,498 0,499 0,500 1,501 1,502 1,503 0,504 0,505 1,506 1,507 1,508 0,509 1,510 1,511 0,512 0,513 1,514 0,515 0,516 0,517 1,518 0,519 0,520 0,521 0,522 1,523 1,524 0,525 0,526 0,527 0,528 1,529 0,530 1,531 1,532 0,533 0,534 1,535 1,536 0,537 0,538 1,539 1,540 1,541 0,542 1,543 0,544 0,545 0,546 0,547 0,548 1,549 1,550 1,551 0,552 1,553 1,554 0,555 0,556 1,557 0,558 1,559 0,560 1,561 1,562 0,563 0,564 0,565 0,566 1,567 0,568 1,569 1,570 1,571 0,572 1,573 0,574 0,575 0,576 0,577 1,578 0,579 1,580 1,581 0,582 1,583 1,584 1,585 0,586 0,587 0,588 0,589 0,590 1,591 1,592 0,593 0,594 0,595 0,596 0,597 1,598 1,599 1,600 0,601 0,602 0,603 0,604 1,605 0,606 0,607 1,608 1,609 0,610 1,611 1,612 1,613 0,614 1,615 1,616 1,617 1,618 1,619 0,620 1,621 0,622 1,623 0,624 0,625 0,626 0,627 1,628 1,629 1,630 0,631 0,632 0,633 0,634 1,635 0,636 0,637 1,638 1,639 0,640 1,641 1,642 0,643 1,644 1,645 0,646 0,647 0,648 1,649 0,650 0,651 0,652 1,653 0,654 1,655 0,656 1,657 1,658 1,659 1,660 1,661 0,662 1,663 0,664 0,665 1,666 0,667 1,668 1,669 0,670 0,671 1,672 1,673 1,674 0,675 0,676 0,677 1,678 1,679 0,680 0,681 0,682 0,683 1,684 0,685 0,686 1,687 0,688 0,689 0,690 0,691 1,692 0,693 1,694 1,695 0,696 1,697 0,698 0,699 1,700 1,701 1,702 0,703 1,704 0,705 0,706 0,707 1,708 1,709 0,710 1,711 0,712 1,713 1,714 1,715 1,716 1,717 1,718 0,719 1,720 1,721 0,722 0,723 0,724 0,725 0,726 0,727 1,728 0,729 0,730 1,731 0,732 0,733 0,734 0,735 0,736 0,737 0,738 0,739 0,740 0,741 0,742 0,743 0,744 0,745 1,746 0,747 0,748 1,749 0,750 1,751 1,752 0,753 1,754 1,755 1,756 1,757 1,758 0,759 0,760 1,761 0,762 0,763 1,764 1,765 1,766 1,767 1,768 0,769 0,770 0,771 0,772 1,773 0,774 0,775 0,776 0,777 1,778 1,779 0,780 0,781 0,782 1,783 0,784 1,785 0,786 0,787 0,788 1,789 0,790 1,791 0,792 1,793 1,794 0,795 1,796 0,797 1,798 0,799 0,800 0,801 1,802 0,803 1,804 0,805 1,806 1,807 1,808 1,809 0,810 0,811 1,812 0,813 1,814 1,815 0,816 0,817 0,818 0,819 0,820 0,821 0,822 0,823 0,824 1,825 0,826 0,827 0,828 0,829 1,830 1,831 0,832 1,833 0,834 1,835 1,836 0,837 1,838 1,839 1,840 1,841 0,842 1,843 1,844 0,845 1,846 1,847 0,848 1,849 1,850 1,851 1,852 0,853 0,854 1,855 1,856 0,857 1,858 1,859 1,860 1,861 1,862 1,863 1,864 1,865 1,866 1,867 1,868 0,869 0,870 0,871 1,872 0,873 1,874 1,875 1,876 0,877 1,878 1,879 1,880 1,881 1,882 0,883 1,884 0,885 0,886 0,887 0,888 1,889 1,890 1,891 0,892 0,893 0,894 0,895 0,896 0,897 1,898 1,899 1,900 1,901 1,902 1,903 0,904 1,905 0,906 0,907 0,908 0,909 0,910 1,911 1,912 1,913 1,914 1,915 0,916 1,917 1,918 1,919 1,920 1,921 1,922 0,923 1,924 1,925 0,926 0,927 1,928 1,929 0,930 0,931 1,932 1,933 0,934 0,935 1,936 0,937 0,938 1,939 1,940 0,941 0,942 1,943 1,944 0,945 1,946 1,947 0,948 1,949 0,950 0,951 0,952 1,953 1,954 0,955 0,956 1,957 0,958 1,959 1,960 0,961 1,962 1,963 0,964 0,965 0,966 1,967 0,968 0,969 1,970 1,971 0,972 1,973 1,974 0,975 0,976 0,977 0,978 1,979 1,980 0,981 1,982 0,983 0,984 0,985 1,986 0,987 1,988 1,989 0,990 1,991 1,992 1,993 1,994 0,995 1,996 1,997 0,998 1,999 1,1000 1,1001 1,1002 0,1003 1,1004 0,1005 1,1006 1,1007 1,1008 1,1009 0,1010 1,1011 1,1012 1,1013 1,1014 0,1015 1,1016 1,1017 0,1018 1,1019 1,1020 1,1021 1,1022 1,1023 0,1024 0,1025 0,1026 1,1027 1,1028 0,1029 0,1030 1,1031 1,1032 1,1033 1,1034 1,1035 0,1036 1,1037 1,1038 1,1039 1,1040 0,1041 0,1042 1,1043 0,1044 0,1045 1,1046 0,1047 1,1048 0,1049 1,1050 0,1051 0,1052 0,1053 1,1054 1,1055 1,1056 1,1057 0,1058 0,1059 1,1060 0,1061 0,1062 1,1063 0,1064 0,1065 1,1066 0,1067 1,1068 0,1069 1,1070 1,1071 1,1072 0,1073 1,1074 1,1075 0,1076 0,1077 1,1078 1,1079 0,1080 1,1081 0,1082 1,1083 1,1084 1,1085 0,1086 0,1087 1,1088 1,1089 0,1090 0,1091 1,1092 1,1093 1,1094 1,1095 1,1096 0,1097 0,1098 0,1099 1,1100 0,1101 1,1102 1,1103 0,1104 1,1105 0,1106 1,1107 1,1108 0,1109 0,1110 1,1111 1,1112 1,1113 0,1114 0,1115 0,1116 1,1117 1,1118 1,1119 0,1120 0,1121 0,1122 0,1123 1,1124 1,1125 1,1126 0,1127 0,1128 1,1129 1,1130 0,1131 0,1132 1,1133 1,1134 0,1135 1,1136 0,1137 0,1138 0,1139 0,1140 1,1141 0,1142 0,1143 0,1144 0,1145 0,1146 1,1147 1,1148 1,1149 0,1150 0,1151 0,1152 0,1153 1,1154 1,1155 0,1156 1,1157 1,1158 1,1159 1,1160 1,1161 1,1162 0,1163 0,1164 1,1165 1,1166 0,1167 0,1168 1,1169 1,1170 0,1171 1,1172 1,1173 1,1174 1,1175 1,1176 0,1177 0,1178 0,1179 1,1180 1,1181 0,1182 1,1183 1,1184 1,1185 0,1186 0,1187 1,1188 0,1189 1,1190 0,1191 1,1192 1,1193 1,1194 1,1195 0,1196 1,1197 0,1198 0,1199 0,1200 0,