問題文
function solution(items, cursor, size)を書いてください。入出力はJSON値です。入力配列やオブジェクトを変更しないでください。外部ライブラリ・ネットワーク・非同期関数は使えません。 items:{id:string,...JSON}[] with unique IDs; cursor:string|null; size:number. Use 10 for a nonpositive/noninteger size and cap at 100. A null cursor starts at the beginning; otherwise start AFTER its matching ID. Unknown cursor yields {items:[],nextCursor:null}. Return the last returned ID as nextCursor only if more items remain. Never mutate input. 入力範囲:各入力配列は最大50,000項目、文字列は最大1,000文字です。数値は有限値で、整数と整数の合算結果はJavaScriptの安全な整数範囲内です。その他の型と有効性は上記の規則に従います。
入出力例
例 1
関数の引数
[
[
{
"id": "a"
},
{
"id": "b"
},
{
"id": "c"
}
],
null,
2
]戻り値
{
"items": [
{
"id": "a"
},
{
"id": "b"
}
],
"nextCursor": "b"
}例 2
関数の引数
[
[
{
"id": "a"
},
{
"id": "b"
}
],
"a",
1
]戻り値
{
"items": [
{
"id": "b"
}
],
"nextCursor": null
}例 3
関数の引数
[
[
{
"id": "__proto__"
}
],
null,
1
]戻り値
{
"items": [
{
"id": "__proto__"
}
],
"nextCursor": null
}