CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 2442,3    "name": "number_of_arithmetic_triplets",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/number-of-arithmetic-triplets/",6    "date": "1659225600000",7    "task_description": "You are given a **0-indexed**, **strictly increasing** integer array `nums` and a positive integer `diff`. A triplet `(i, j, k)` is an **arithmetic triplet** if the following conditions are met: `i < j < k`, `nums[j] - nums[i] == diff`, and `nums[k] - nums[j] == diff`. Return _the number of unique **arithmetic triplets**._ **Example 1:** ``` **Input:** nums = [0,1,4,6,7,10], diff = 3 **Output:** 2 **Explanation:** (1, 2, 4) is an arithmetic triplet because both 7 - 4 == 3 and 4 - 1 == 3. (2, 4, 5) is an arithmetic triplet because both 10 - 7 == 3 and 7 - 4 == 3. ``` **Example 2:** ``` **Input:** nums = [4,5,6,7,8,9], diff = 2 **Output:** 2 **Explanation:** (0, 2, 4) is an arithmetic triplet because both 8 - 6 == 2 and 6 - 4 == 2. (1, 3, 5) is an arithmetic triplet because both 9 - 7 == 2 and 7 - 5 == 2. ``` **Constraints:** `3 <= nums.length <= 200` `0 <= nums[i] <= 200` `1 <= diff <= 50` `nums` is **strictly** increasing.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [0,1,4,6,7,10], diff = 3",12            "output": "2 "13        },14        {15            "label": "Example 2",16            "input": "nums = [4,5,6,7,8,9], diff = 2",17            "output": "2 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                [24                    4,25                    7,26                    13,27                    18,28                    20,29                    27,30                    29,31                    30,32                    42,33                    47,34                    54,35                    57,36                    63,37                    65,38                    66,39                    68,40                    70,41                    83,42                    92,43                    93,44                    95,45                    99,46                    103,47                    117,48                    118,49                    119,50                    120,51                    126,52                    128,53                    136,54                    144,55                    145,56                    154,57                    159,58                    161,59                    164,60                    168,61                    172,62                    174,63                    177,64                    184,65                    187,66                    196,67                    197,68                    198,69                    19970                ],71                2672            ],73            "output": 374        },75        {76            "input": [77                [78                    0,79                    1,80                    2,81                    5,82                    8,83                    9,84                    10,85                    16,86                    17,87                    18,88                    20,89                    22,90                    23,91                    24,92                    27,93                    28,94                    30,95                    31,96                    32,97                    34,98                    36,99                    38,100                    39,101                    40,102                    41,103                    42,104                    43,105                    44,106                    45,107                    46,108                    47,109                    51,110                    52,111                    53,112                    54,113                    55,114                    57,115                    58,116                    61,117                    64,118                    65,119                    69,120                    72,121                    75,122                    76,123                    80,124                    81,125                    83,126                    85,127                    86,128                    87,129                    88,130                    90,131                    91,132                    92,133                    94,134                    95,135                    101,136                    102,137                    103,138                    104,139                    105,140                    107,141                    108,142                    110,143                    113,144                    114,145                    116,146                    117,147                    119,148                    120,149                    121,150                    122,151                    126,152                    127,153                    128,154                    129,155                    130,156                    132,157                    133,158                    134,159                    135,160                    136,161                    137,162                    138,163                    139,164                    140,165                    142,166                    143,167                    144,168                    146,169                    147,170                    148,171                    149,172                    155,173                    156,174                    157,175                    158,176                    159,177                    160,178                    161,179                    162,180                    163,181                    164,182                    165,183                    166,184                    167,185                    170,186                    171,187                    172,188                    176,189                    177,190                    179,191                    180,192                    182,193                    184,194                    185,195                    186,196                    189,197                    190,198                    193,199                    198,200                    199201                ],202                26203            ],204            "output": 39205        },206        {207            "input": [208                [209                    0,210                    1,211                    4,212                    5,213                    8,214                    10,215                    11,216                    15,217                    17,218                    20,219                    22,220                    24,221                    26,222                    34,223                    38,224                    45,225                    46,226                    54,227                    55,228                    56,229                    57,230                    58,231                    60,232                    63,233                    65,234                    66,235                    68,236                    74,237                    78,238                    79,239                    86,240                    88,241                    91,242                    92,243                    93,244                    94,245                    95,246                    99,247                    101,248                    104,249                    106,250                    107,251                    113,252                    115,253                    117,254                    118,255                    120,256                    122,257                    123,258                    126,259                    129,260                    130,261                    131,262                    133,263                    137,264                    143,265                    144,266                    152,267                    155,268                    157,269                    158,270                    161,271                    165,272                    166,273                    168,274                    171,275                    175,276                    176,277                    188,278                    189,279                    192,280                    196,281                    197282                ],283                17284            ],285            "output": 3286        },287        {288            "input": [289                [290                    1,291                    2,292                    4,293                    8,294                    9,295                    10,296                    17,297                    18,298                    20,299                    21,300                    23,301                    24,302                    26,303                    27,304                    30,305                    32,306                    33,307                    34,308                    36,309                    38,310                    39,311                    43,312                    55,313                    58,314                    61,315                    66,316                    71,317                    72,318                    73,319                    74,320                    75,321                    76,322                    79,323                    81,324                    82,325                    83,326                    85,327                    86,328                    93,329                    97,330                    99,331                    100,332                    105,333                    107,334                    108,335                    111,336                    115,337                    116,338                    118,339                    121,340                    125,341                    126,342                    129,343                    133,344                    137,345                    141,346                    142,347                    143,348                    144,349                    150,350                    151,351                    153,352                    154,353                    159,354                    163,355                    168,356                    172,357                    174,358                    176,359                    177,360                    178,361                    180,362                    182,363                    183,364                    184,365                    185,366                    186,367                    192,368                    195,369                    196370                ],371                39372            ],373            "output": 8374        },375        {376            "input": [377                [378                    3,379                    5,380                    7,381                    8,382                    9,383                    10,384                    11,385                    12,386                    13,387                    14,388                    16,389                    18,390                    19,391                    20,392                    24,393                    26,394                    27,395                    28,396                    29,397                    30,398                    34,399                    35,400                    37,401                    38,402                    40,403                    41,404                    42,405                    44,406                    45,407                    46,408                    48,409                    49,410                    50,411                    51,412                    52,413                    53,414                    55,415                    56,416                    61,417                    63,418                    64,419                    66,420                    67,421                    68,422                    70,423                    71,424                    73,425                    75,426                    76,427                    79,428                    80,429                    81,430                    82,431                    83,432                    84,433                    85,434                    86,435                    87,436                    91,437                    93,438                    94,439                    95,440                    97,441                    98,442                    100,443                    101,444                    102,445                    103,446                    104,447                    105,448                    108,449                    110,450                    112,451                    113,452                    114,453                    115,454                    117,455                    119,456                    120,457                    121,458                    122,459                    125,460                    127,461                    128,462                    129,463                    130,464                    131,465                    132,466                    134,467                    136,468                    137,469                    138,470                    144,471                    145,472                    146,473                    147,474                    148,475                    149,476                    150,477                    154,478                    156,479                    158,480                    161,481                    162,482                    164,483                    165,484                    167,485                    168,486                    169,487                    171,488                    173,489                    174,490                    175,491                    176,492                    178,493                    179,494                    182,495                    184,496                    185,497                    186,498                    188,499                    189,500                    190,501                    191,502                    192,503                    193,504                    194,505                    195,506                    196,507                    197,508                    198,509                    200510                ],511                8512            ],513            "output": 47514        },515        {516            "input": [517                [518                    0,519                    1,520                    3,521                    4,522                    5,523                    6,524                    7,525                    8,526                    9,527                    11,528                    12,529                    13,530                    15,531                    16,532                    17,533                    18,534                    19,535                    20,536                    27,537                    30,538                    32,539                    34,540                    35,541                    36,542                    37,543                    39,544                    43,545                    45,546                    46,547                    47,548                    48,549                    50,550                    51,551                    52,552                    53,553                    55,554                    56,555                    57,556                    58,557                    60,558                    61,559                    62,560                    64,561                    65,562                    66,563                    67,564                    68,565                    69,566                    70,567                    72,568                    73,569                    74,570                    76,571                    77,572                    78,573                    79,574                    80,575                    81,576                    82,577                    83,578                    84,579                    85,580                    86,581                    88,582                    90,583                    91,584                    92,585                    93,586                    95,587                    96,588                    97,589                    98,590                    99,591                    100,592                    101,593                    102,594                    103,595                    105,596                    107,597                    108,598                    110,599                    111,600                    112,601                    113,602                    115,603                    116,604                    117,605                    118,606                    120,607                    121,608                    122,609                    125,610                    127,611                    128,612                    131,613                    132,614                    134,615                    137,616                    138,617                    139,618                    140,619                    141,620                    142,621                    143,622                    145,623                    146,624                    149,625                    152,626                    153,627                    154,628                    155,629                    156,630                    158,631                    160,632                    161,633                    165,634                    167,635                    171,636                    173,637                    174,638                    175,639                    177,640                    178,641                    179,642                    182,643                    183,644                    184,645                    185,646                    187,647                    190,648                    191,649                    194,650                    195,651                    197652                ],653                15654            ],655            "output": 61656        },657        {658            "input": [659                [660                    4,661                    9,662                    10,663                    13,664                    16,665                    17,666                    18,667                    20,668                    21,669                    22,670                    25,671                    26,672                    27,673                    35,674                    36,675                    41,676                    43,677                    44,678                    47,679                    48,680                    51,681                    52,682                    56,683                    57,684                    64,685                    65,686                    69,687                    71,688                    73,689                    76,690                    78,691                    79,692                    80,693                    81,694                    85,695                    86,696                    87,697                    88,698                    90,699                    91,700                    92,701                    98,702                    101,703                    102,704                    108,705                    109,706                    111,707                    112,708                    113,709                    126,710                    128,711                    129,712                    130,713                    131,714                    133,715                    135,716                    139,717                    141,718                    149,719                    155,720                    156,721                    162,722                    163,723                    164,724                    165,725                    167,726                    168,727                    169,728                    170,729                    172,730                    173,731                    174,732                    175,733                    176,734                    179,735                    182,736                    183,737                    187,738                    191,739                    192,740                    194,741                    195,742                    196,743                    197,744                    198745                ],746                6747            ],748            "output": 14749        },750        {751            "input": [752                [753                    0,754                    1,755                    2,756                    3,757                    4,758                    5,759                    11,760                    13,761                    15,762                    18,763                    20,764                    22,765                    23,766                    25,767                    26,768                    28,769                    32,770                    34,771                    36,772                    39,773                    41,774                    43,775                    51,776                    52,777                    53,778                    54,779                    55,780                    59,781                    62,782                    69,783                    70,784                    72,785                    76,786                    77,787                    78,788                    81,789                    83,790                    86,791                    89,792                    90,793                    91,794                    94,795                    95,796                    97,797                    98,798                    100,799                    104,800                    108,801                    109,802                    110,803                    111,804                    115,805                    116,806                    119,807                    122,808                    125,809                    126,810                    127,811                    130,812                    132,813                    134,814                    138,815                    139,816                    141,817                    142,818                    148,819                    149,820                    152,821                    153,822                    154,823                    155,824                    158,825                    159,826                    161,827                    162,828                    163,829                    164,830                    167,831                    169,832                    170,833                    175,834                    179,835                    182,836                    184,837                    189,838                    192,839                    193,840                    194,841                    199,842                    200843                ],844                6845            ],846            "output": 14847        },848        {849            "input": [850                [851                    1,852                    2,853                    6,854                    30,855                    43,856                    47,857                    48,858                    50,859                    52,860                    55,861                    60,862                    63,863                    71,864                    72,865                    78,866                    81,867                    84,868                    87,869                    96,870                    97,871                    117,872                    125,873                    126,874                    137,875                    142,876                    154,877                    167,878                    172,879                    174,880                    178,881                    180,882                    197,883                    200884                ],885                20886            ],887            "output": 1888        },889        {890            "input": [891                [892                    1,893                    2,894                    5,895                    8,896                    11,897                    12,898                    14,899                    15,900                    17,901                    18,902                    21,903                    23,904                    24,905                    25,906                    26,907                    28,908                    29,909                    32,910                    33,911                    34,912                    35,913                    36,914                    37,915                    38,916                    39,917                    42,918                    48,919                    49,920                    50,921                    51,922                    52,923                    53,924                    55,925                    56,926                    58,927                    61,928                    64,929                    65,930                    66,931                    67,932                    68,933                    69,934                    73,935                    74,936                    75,937                    76,938                    77,939                    82,940                    86,941                    87,942                    90,943                    91,944                    92,945                    93,946                    96,947                    97,948                    100,949                    109,950                    110,951                    111,952                    112,953                    113,954                    118,955                    121,956                    122,957                    123,958                    124,959                    125,960                    126,961                    129,962                    131,963                    132,964                    133,965                    135,966                    136,967                    137,968                    138,969                    141,970                    142,971                    143,972                    146,973                    149,974                    151,975                    152,976                    154,977                    155,978                    158,979                    159,980                    162,981                    163,982                    167,983                    168,984                    169,985                    171,986                    172,987                    175,988                    179,989                    180,990                    182,991                    183,992                    184,993                    185,994                    186,995                    188,996                    190,997                    193,998                    194,999                    195,1000                    196,1001                    197,1002                    199,1003                    2001004                ],1005                211006            ],1007            "output": 261008        }1009    ],1010    "haskell_template": "arithmeticTriplets :: [Int] -> Int -> Int\narithmeticTriplets nums diff ",1011    "ocaml_template": "let arithmeticTriplets (nums: int list) (diff: int) : int =  ",1012    "scala_template": "def arithmeticTriplets(nums: List[Int],diff: Int): Int = { \n    \n}",1013    "java_template": "public static int arithmeticTriplets(List<Integer> nums, int diff) {\n\n}",1014    "python_template": "class Solution(object):\n    def arithmeticTriplets(self, nums, diff):\n        \"\"\"\n        :type nums: List[int]\n        :type diff: int\n        :rtype: int\n        \"\"\"\n        "1015}