CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 2793,3    "name": "count_the_number_of_complete_components",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/count-the-number-of-complete-components/",6    "date": "2023-05-07 00:00:00",7    "task_description": "You are given an integer `n`. There is an **undirected** graph with `n` vertices, numbered from `0` to `n - 1`. You are given a 2D integer array `edges` where `edges[i] = [ai, bi]` denotes that there exists an **undirected** edge connecting vertices `ai` and `bi`. Return _the number of **complete connected components** of the graph_. A **connected component** is a subgraph of a graph in which there exists a path between any two vertices, and no vertex of the subgraph shares an edge with a vertex outside of the subgraph. A connected component is said to be complete if there exists an edge between every pair of its vertices. **Example 1:** **** ``` **Input:** n = 6, edges = [[0,1],[0,2],[1,2],[3,4]] **Output:** 3 **Explanation:** From the picture above, one can see that all of the components of this graph are complete. ``` **Example 2:** **** ``` **Input:** n = 6, edges = [[0,1],[0,2],[1,2],[3,4],[3,5]] **Output:** 1 **Explanation:** The component containing vertices 0, 1, and 2 is complete since there is an edge between every pair of two vertices. On the other hand, the component containing vertices 3, 4, and 5 is not complete since there is no edge between vertices 4 and 5. Thus, the number of complete components in this graph is 1. ``` **Constraints:** `1 <= n <= 50` `0 <= edges.length <= n * (n - 1) / 2` `edges[i].length == 2` `0 <= ai, bi <= n - 1` `ai != bi` There are no repeated edges.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "n = 6, edges = [[0,1],[0,2],[1,2],[3,4]]",12            "output": "3 "13        },14        {15            "label": "Example 2",16            "input": "n = 6, edges = [[0,1],[0,2],[1,2],[3,4],[3,5]]",17            "output": "1 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                17,24                [25                    [26                        4,27                        028                    ],29                    [30                        12,31                        732                    ],33                    [34                        3,35                        436                    ],37                    [38                        4,39                        940                    ],41                    [42                        4,43                        644                    ],45                    [46                        5,47                        148                    ],49                    [50                        3,51                        1652                    ],53                    [54                        5,55                        756                    ],57                    [58                        5,59                        1360                    ],61                    [62                        11,63                        264                    ],65                    [66                        5,67                        1068                    ],69                    [70                        10,71                        072                    ],73                    [74                        9,75                        876                    ],77                    [78                        0,79                        280                    ],81                    [82                        1,83                        084                    ],85                    [86                        0,87                        888                    ],89                    [90                        0,91                        1492                    ],93                    [94                        11,95                        1496                    ],97                    [98                        1,99                        9100                    ],101                    [102                        15,103                        2104                    ],105                    [106                        13,107                        11108                    ],109                    [110                        13,111                        8112                    ],113                    [114                        7,115                        4116                    ],117                    [118                        15,119                        11120                    ],121                    [122                        15,123                        5124                    ],125                    [126                        15,127                        14128                    ],129                    [130                        6,131                        11132                    ],133                    [134                        6,135                        8136                    ],137                    [138                        7,139                        13140                    ],141                    [142                        12,143                        3144                    ],145                    [146                        12,147                        9148                    ],149                    [150                        4,151                        5152                    ],153                    [154                        14,155                        9156                    ],157                    [158                        4,159                        8160                    ],161                    [162                        8,163                        2164                    ],165                    [166                        14,167                        15168                    ],169                    [170                        9,171                        4172                    ],173                    [174                        9,175                        10176                    ],177                    [178                        9,179                        16180                    ],181                    [182                        10,183                        5184                    ],185                    [186                        13,187                        4188                    ],189                    [190                        9,191                        13192                    ],193                    [194                        11,195                        7196                    ],197                    [198                        11,199                        16200                    ],201                    [202                        8,203                        14204                    ],205                    [206                        0,207                        10208                    ],209                    [210                        11,211                        13212                    ],213                    [214                        16,215                        3216                    ],217                    [218                        1,219                        8220                    ],221                    [222                        7,223                        0224                    ],225                    [226                        1,227                        14228                    ],229                    [230                        7,231                        9232                    ],233                    [234                        6,235                        13236                    ],237                    [238                        7,239                        6240                    ],241                    [242                        16,243                        15244                    ],245                    [246                        6,247                        16248                    ],249                    [250                        12,251                        8252                    ],253                    [254                        3,255                        11256                    ],257                    [258                        3,259                        8260                    ],261                    [262                        3,263                        14264                    ],265                    [266                        4,267                        13268                    ],269                    [270                        8,271                        7272                    ],273                    [274                        11,275                        3276                    ],277                    [278                        2,279                        0280                    ],281                    [282                        13,283                        0284                    ],285                    [286                        11,287                        6288                    ],289                    [290                        8,291                        13292                    ],293                    [294                        15,295                        6296                    ],297                    [298                        0,299                        15300                    ],301                    [302                        15,303                        3304                    ],305                    [306                        15,307                        9308                    ]309                ]310            ],311            "output": 0312        },313        {314            "input": [315                38,316                [317                    [318                        26,319                        21320                    ],321                    [322                        15,323                        21324                    ],325                    [326                        18,327                        26328                    ],329                    [330                        7,331                        26332                    ],333                    [334                        27,335                        4336                    ],337                    [338                        29,339                        32340                    ],341                    [342                        19,343                        9344                    ],345                    [346                        30,347                        9348                    ],349                    [350                        19,351                        18352                    ],353                    [354                        30,355                        18356                    ],357                    [358                        11,359                        23360                    ],361                    [362                        10,363                        27364                    ],365                    [366                        33,367                        29368                    ],369                    [370                        34,371                        3372                    ],373                    [374                        2,375                        32376                    ],377                    [378                        3,379                        6380                    ],381                    [382                        22,383                        19384                    ],385                    [386                        3,387                        15388                    ],389                    [390                        26,391                        7392                    ],393                    [394                        7,395                        30396                    ],397                    [398                        27,399                        8400                    ],401                    [402                        30,403                        4404                    ],405                    [406                        19,407                        4408                    ],409                    [410                        6,411                        34412                    ],413                    [414                        29,415                        36416                    ],417                    [418                        0,419                        9420                    ],421                    [422                        33,423                        6424                    ],425                    [426                        33,427                        15428                    ],429                    [430                        33,431                        24432                    ],433                    [434                        25,435                        20436                    ],437                    [438                        10,439                        31440                    ],441                    [442                        25,443                        29444                    ],445                    [446                        34,447                        16448                    ],449                    [450                        22,451                        23452                    ],453                    [454                        14,455                        19456                    ],457                    [458                        37,459                        30460                    ],461                    [462                        14,463                        37464                    ],465                    [466                        15,467                        2468                    ],469                    [470                        29,471                        13472                    ],473                    [474                        21,475                        18476                    ],477                    [478                        29,479                        31480                    ],481                    [482                        10,483                        8484                    ],485                    [486                        25,487                        6488                    ],489                    [490                        2,491                        13492                    ],493                    [494                        10,495                        26496                    ],497                    [498                        25,499                        24500                    ],501                    [502                        33,503                        37504                    ],505                    [506                        34,507                        2508                    ],509                    [510                        3,511                        5512                    ],513                    [514                        14,515                        23516                    ],517                    [518                        14,519                        32520                    ],521                    [522                        17,523                        25524                    ],525                    [526                        18,527                        2528                    ],529                    [530                        6,531                        15532                    ],533                    [534                        21,535                        13536                    ],537                    [538                        21,539                        31540                    ],541                    [542                        33,543                        5544                    ],545                    [546                        10,547                        12548                    ],549                    [550                        2,551                        17552                    ],553                    [554                        34,555                        6556                    ],557                    [558                        37,559                        2560                    ],561                    [562                        3,563                        0564                    ],565                    [566                        22,567                        13568                    ],569                    [570                        14,571                        0572                    ],573                    [574                        32,575                        36576                    ],577                    [578                        14,579                        18580                    ],581                    [582                        16,583                        37584                    ],585                    [586                        28,587                        20588                    ],589                    [590                        5,591                        36592                    ],593                    [594                        9,595                        34596                    ],597                    [598                        21,599                        8600                    ],601                    [602                        21,603                        17604                    ],605                    [606                        6,607                        28608                    ],609                    [610                        10,611                        7612                    ],613                    [614                        2,615                        3616                    ],617                    [618                        25,619                        5620                    ],621                    [622                        2,623                        21624                    ],625                    [626                        2,627                        30628                    ],629                    [630                        16,631                        32632                    ],633                    [634                        28,635                        6636                    ],637                    [638                        36,639                        19640                    ],641                    [642                        5,643                        22644                    ],645                    [646                        17,647                        24648                    ],649                    [650                        36,651                        37652                    ],653                    [654                        29,655                        16656                    ],657                    [658                        6,659                        32660                    ],661                    [662                        21,663                        30664                    ],665                    [666                        10,667                        2668                    ],669                    [670                        33,671                        4672                    ],673                    [674                        31,675                        34676                    ],677                    [678                        25,679                        0680                    ],681                    [682                        32,683                        8684                    ],685                    [686                        2,687                        16688                    ],689                    [690                        32,691                        17692                    ],693                    [694                        32,695                        26696                    ],697                    [698                        13,699                        22700                    ],701                    [702                        35,703                        22704                    ],705                    [706                        16,707                        18708                    ],709                    [710                        1,711                        29712                    ],713                    [714                        16,715                        27716                    ],717                    [718                        36,719                        14720                    ],721                    [722                        9,723                        6724                    ],725                    [726                        5,727                        17728                    ],729                    [730                        28,731                        19732                    ],733                    [734                        36,735                        32736                    ],737                    [738                        17,739                        19740                    ],741                    [742                        5,743                        26744                    ],745                    [746                        6,747                        18748                    ],749                    [750                        21,751                        16752                    ],753                    [754                        20,755                        29756                    ],757                    [758                        12,759                        25760                    ],761                    [762                        23,763                        34764                    ],765                    [766                        32,767                        21768                    ],769                    [770                        13,771                        17772                    ],773                    [774                        1,775                        15776                    ],777                    [778                        16,779                        22780                    ],781                    [782                        13,783                        35784                    ],785                    [786                        1,787                        33788                    ],789                    [790                        24,791                        35792                    ],793                    [794                        17,795                        5796                    ],797                    [798                        5,799                        12800                    ],801                    [802                        5,803                        21804                    ],805                    [806                        17,807                        23808                    ],809                    [810                        5,811                        30812                    ],813                    [814                        27,815                        36816                    ],817                    [818                        31,819                        24820                    ],821                    [822                        24,823                        3824                    ],825                    [826                        13,827                        3828                    ],829                    [830                        4,831                        34832                    ],833                    [834                        1,835                        10836                    ],837                    [838                        24,839                        12840                    ],841                    [842                        35,843                        12844                    ],845                    [846                        13,847                        30848                    ],849                    [850                        17,851                        9852                    ],853                    [854                        5,855                        16856                    ],857                    [858                        5,859                        25860                    ],861                    [862                        27,863                        22864                    ],865                    [866                        19,867                        36868                    ],869                    [870                        31,871                        1872                    ],873                    [874                        0,875                        32876                    ],877                    [878                        31,879                        19880                    ],881                    [882                        20,883                        19884                    ],885                    [886                        23,887                        15888                    ],889                    [890                        12,891                        24892                    ],893                    [894                        20,895                        37896                    ],897                    [898                        31,899                        37900                    ],901                    [902                        24,903                        7904                    ],905                    [906                        32,907                        20908                    ],909                    [910                        16,911                        3912                    ],913                    [914                        24,915                        16916                    ],917                    [918                        35,919                        25920                    ],921                    [922                        16,923                        30924                    ],925                    [926                        26,927                        34928                    ],929                    [930                        15,931                        34932                    ],933                    [934                        27,935                        17936                    ],937                    [938                        19,939                        13940                    ],941                    [942                        31,943                        5944                    ],945                    [946                        11,947                        36948                    ],949                    [950                        23,951                        1952                    ],953                    [954                        20,955                        14956                    ],957                    [958                        12,959                        10960                    ],961                    [962                        4,963                        6964                    ],965                    [966                        13,967                        2968                    ],969                    [970                        24,971                        11972                    ],973                    [974                        15,975                        20976                    ],977                    [978                        5,979                        6980                    ],981                    [982                        7,983                        25984                    ],985                    [986                        18,987                        25988                    ],989                    [990                        27,991                        3992                    ],993                    [994                        7,995                        34996                    ],997                    [998                        19,999                        171000                    ],1001                    [1002                        30,1003                        171004                    ],1005                    [1006                        19,1007                        261008                    ],1009                    [1010                        11,1011                        221012                    ],1013                    [1014                        0,1015                        221016                    ],1017                    [1018                        31,1019                        01020                    ],1021                    [1022                        12,1023                        141024                    ],1025                    [1026                        34,1027                        291028                    ],1029                    [1030                        24,1031                        61032                    ],1033                    [1034                        35,1035                        61036                    ],1037                    [1038                        22,1039                        361040                    ],1041                    [1042                        26,1043                        241044                    ],1045                    [1046                        15,1047                        241048                    ],1049                    [1050                        26,1051                        331052                    ],1053                    [1054                        7,1055                        291056                    ],1057                    [1058                        27,1059                        161060                    ],1061                    [1062                        8,1063                        121064                    ],1065                    [1066                        11,1067                        81068                    ],1069                    [1070                        0,1071                        81072                    ],1073                    [1074                        30,1075                        211076                    ],1077                    [1078                        8,1079                        301080                    ],1081                    [1082                        0,1083                        351084                    ],1085                    [1086                        12,1087                        01088                    ],1089                    [1090                        33,1091                        321092                    ],1093                    [1094                        23,1095                        181096                    ],1097                    [1098                        34,1099                        151100                    ],1101                    [1102                        34,1103                        241104                    ],1105                    [1106                        34,1107                        331108                    ],1109                    [1110                        14,1111                        271112                    ],1113                    [1114                        3,1115                        271116                    ],1117                    [1118                        14,1119                        361120                    ],1121                    [1122                        26,1123                        101124                    ],1125                    [1126                        7,1127                        151128                    ],1129                    [1130                        18,1131                        151132                    ],1133                    [1134                        26,1135                        281136                    ],1137                    [1138                        27,1139                        21140                    ],1141                    [1142                        8,1143                        71144                    ],1145                    [1146                        27,1147                        201148                    ],1149                    [1150                        8,1151                        161152                    ],1153                    [1154                        0,1155                        121156                    ],1157                    [1158                        25,1159                        231160                    ],1161                    [1162                        33,1163                        361164                    ],1165                    [1166                        34,1167                        11168                    ],1169                    [1170                        25,1171                        321172                    ],1173                    [1174                        34,1175                        101176                    ],1177                    [1178                        37,1179                        151180                    ],1181                    [1182                        14,1183                        131184                    ],1185                    [1186                        37,1187                        241188                    ],1189                    [1190                        3,1191                        221192                    ],1193                    [1194                        14,1195                        311196                    ],1197                    [1198                        26,1199                        51200                    ],

Showing the first 1,200 of 8410 lines. Download the file for the rest.