Skip to content

Commit 4b3414a

Browse files
committed
fix : functions
1 parent 6a4f103 commit 4b3414a

1 file changed

Lines changed: 90 additions & 75 deletions

File tree

‎lua/leetcode/api/problems.lua‎

Lines changed: 90 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,19 @@ function Problems.two_pointers_75(cb)
183183
limit = 75,
184184
version = "v2"
185185
}, {
186-
callback = function(res, err)
187-
if err then
188-
return cb(nil, err)
189-
end
186+
callback = function(res, err)
187+
if err then
188+
return cb(nil, err)
189+
end
190190
local title_slugs = {}
191191
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
192192
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
193193
table.insert(title_slugs, q.titleSlug)
194194
end
195195
end
196196
return cb(title_slugs)
197-
})
197+
end
198+
})
198199
end
199200

200201
function Problems.sliding_window_75(cb)
@@ -205,18 +206,19 @@ function Problems.sliding_window_75(cb)
205206
limit = 75,
206207
version = "v2"
207208
}, {
208-
callback = function(res, err)
209-
if err then
210-
return cb(nil, err)
211-
end
209+
callback = function(res, err)
210+
if err then
211+
return cb(nil, err)
212+
end
212213
local title_slugs = {}
213214
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
214215
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
215216
table.insert(title_slugs, q.titleSlug)
216217
end
217218
end
218219
return cb(title_slugs)
219-
})
220+
end
221+
})
220222
end
221223

222224
function Problems.stack_75(cb)
@@ -227,18 +229,19 @@ function Problems.stack_75(cb)
227229
limit = 75,
228230
version = "v2"
229231
}, {
230-
callback = function(res, err)
231-
if err then
232-
return cb(nil, err)
233-
end
232+
callback = function(res, err)
233+
if err then
234+
return cb(nil, err)
235+
end
234236
local title_slugs = {}
235237
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
236238
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
237239
table.insert(title_slugs, q.titleSlug)
238240
end
239241
end
240242
return cb(title_slugs)
241-
})
243+
end
244+
})
242245
end
243246

244247
function Problems.binary_search_75(cb)
@@ -249,18 +252,19 @@ function Problems.binary_search_75(cb)
249252
limit = 75,
250253
version = "v2"
251254
}, {
252-
callback = function(res, err)
253-
if err then
254-
return cb(nil, err)
255-
end
255+
callback = function(res, err)
256+
if err then
257+
return cb(nil, err)
258+
end
256259
local title_slugs = {}
257260
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
258261
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
259262
table.insert(title_slugs, q.titleSlug)
260263
end
261264
end
262265
return cb(title_slugs)
263-
})
266+
end
267+
})
264268
end
265269

266270
function Problems.linked_list_75(cb)
@@ -271,18 +275,19 @@ function Problems.linked_list_75(cb)
271275
limit = 75,
272276
version = "v2"
273277
}, {
274-
callback = function(res, err)
275-
if err then
276-
return cb(nil, err)
277-
end
278+
callback = function(res, err)
279+
if err then
280+
return cb(nil, err)
281+
end
278282
local title_slugs = {}
279283
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
280284
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
281285
table.insert(title_slugs, q.titleSlug)
282286
end
283287
end
284288
return cb(title_slugs)
285-
})
289+
end
290+
})
286291
end
287292

288293
function Problems.trees_75(cb)
@@ -293,18 +298,19 @@ function Problems.trees_75(cb)
293298
limit = 75,
294299
version = "v2"
295300
}, {
296-
callback = function(res, err)
297-
if err then
298-
return cb(nil, err)
299-
end
301+
callback = function(res, err)
302+
if err then
303+
return cb(nil, err)
304+
end
300305
local title_slugs = {}
301306
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
302307
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
303308
table.insert(title_slugs, q.titleSlug)
304309
end
305310
end
306311
return cb(title_slugs)
307-
})
312+
end
313+
})
308314
end
309315

310316
function Problems.heap_and_priority_queue_75(cb)
@@ -315,18 +321,19 @@ function Problems.heap_and_priority_queue_75(cb)
315321
limit = 75,
316322
version = "v2"
317323
}, {
318-
callback = function(res, err)
319-
if err then
320-
return cb(nil, err)
321-
end
324+
callback = function(res, err)
325+
if err then
326+
return cb(nil, err)
327+
end
322328
local title_slugs = {}
323329
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
324330
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
325331
table.insert(title_slugs, q.titleSlug)
326332
end
327333
end
328334
return cb(title_slugs)
329-
})
335+
end
336+
})
330337
end
331338

332339
function Problems.backtracking_75(cb)
@@ -337,18 +344,19 @@ function Problems.backtracking_75(cb)
337344
limit = 75,
338345
version = "v2"
339346
}, {
340-
callback = function(res, err)
341-
if err then
342-
return cb(nil, err)
343-
end
347+
callback = function(res, err)
348+
if err then
349+
return cb(nil, err)
350+
end
344351
local title_slugs = {}
345352
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
346353
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
347354
table.insert(title_slugs, q.titleSlug)
348355
end
349356
end
350357
return cb(title_slugs)
351-
})
358+
end
359+
})
352360
end
353361

354362
function Problems.tries_75(cb)
@@ -359,18 +367,19 @@ function Problems.tries_75(cb)
359367
limit = 75,
360368
version = "v2"
361369
}, {
362-
callback = function(res, err)
363-
if err then
364-
return cb(nil, err)
365-
end
370+
callback = function(res, err)
371+
if err then
372+
return cb(nil, err)
373+
end
366374
local title_slugs = {}
367375
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
368376
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
369377
table.insert(title_slugs, q.titleSlug)
370378
end
371379
end
372380
return cb(title_slugs)
373-
})
381+
end
382+
})
374383
end
375384

376385
function Problems.graph_75(cb)
@@ -381,18 +390,19 @@ function Problems.graph_75(cb)
381390
limit = 75,
382391
version = "v2"
383392
}, {
384-
callback = function(res, err)
385-
if err then
386-
return cb(nil, err)
387-
end
393+
callback = function(res, err)
394+
if err then
395+
return cb(nil, err)
396+
end
388397
local title_slugs = {}
389398
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
390399
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
391400
table.insert(title_slugs, q.titleSlug)
392401
end
393402
end
394403
return cb(title_slugs)
395-
})
404+
end
405+
})
396406
end
397407

398408
function Problems.dynamic_programming_75(cb)
@@ -403,18 +413,19 @@ function Problems.dynamic_programming_75(cb)
403413
limit = 75,
404414
version = "v2"
405415
}, {
406-
callback = function(res, err)
407-
if err then
408-
return cb(nil, err)
409-
end
416+
callback = function(res, err)
417+
if err then
418+
return cb(nil, err)
419+
end
410420
local title_slugs = {}
411421
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
412422
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
413423
table.insert(title_slugs, q.titleSlug)
414424
end
415425
end
416426
return cb(title_slugs)
417-
})
427+
end
428+
})
418429
end
419430

420431
function Problems.greedy_75(cb)
@@ -425,18 +436,19 @@ function Problems.greedy_75(cb)
425436
limit = 75,
426437
version = "v2"
427438
}, {
428-
callback = function(res, err)
429-
if err then
430-
return cb(nil, err)
431-
end
439+
callback = function(res, err)
440+
if err then
441+
return cb(nil, err)
442+
end
432443
local title_slugs = {}
433444
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
434445
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
435446
table.insert(title_slugs, q.titleSlug)
436447
end
437448
end
438449
return cb(title_slugs)
439-
})
450+
end
451+
})
440452
end
441453

442454
function Problems.interval_75(cb)
@@ -447,18 +459,19 @@ function Problems.interval_75(cb)
447459
limit = 75,
448460
version = "v2"
449461
}, {
450-
callback = function(res, err)
451-
if err then
452-
return cb(nil, err)
453-
end
462+
callback = function(res, err)
463+
if err then
464+
return cb(nil, err)
465+
end
454466
local title_slugs = {}
455467
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
456468
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
457469
table.insert(title_slugs, q.titleSlug)
458470
end
459471
end
460472
return cb(title_slugs)
461-
})
473+
end
474+
})
462475
end
463476

464477
function Problems.math_and_geometry_75(cb)
@@ -469,18 +482,19 @@ function Problems.math_and_geometry_75(cb)
469482
limit = 75,
470483
version = "v2"
471484
}, {
472-
callback = function(res, err)
473-
if err then
474-
return cb(nil, err)
475-
end
485+
callback = function(res, err)
486+
if err then
487+
return cb(nil, err)
488+
end
476489
local title_slugs = {}
477490
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
478491
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
479492
table.insert(title_slugs, q.titleSlug)
480493
end
481494
end
482495
return cb(title_slugs)
483-
})
496+
end
497+
})
484498
end
485499

486500
function Problems.bit_manipulation_75(cb)
@@ -491,18 +505,19 @@ function Problems.bit_manipulation_75(cb)
491505
limit = 75,
492506
version = "v2"
493507
}, {
494-
callback = function(res, err)
495-
if err then
496-
return cb(nil, err)
497-
end
508+
callback = function(res, err)
509+
if err then
510+
return cb(nil, err)
511+
end
498512
local title_slugs = {}
499513
if res.data["favoriteQuestionList"] and res.data["favoriteQuestionList"]["questions"] then
500514
for _, q in ipairs(res.data["favoriteQuestionList"]["questions"]) do
501515
table.insert(title_slugs, q.titleSlug)
502516
end
503517
end
504518
return cb(title_slugs)
505-
})
519+
end
520+
})
506521
end
507522

508523
function Problems.top_interview_150(cb)

0 commit comments

Comments
 (0)