You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/question-service/src/scripts/seed.ts
+32-4Lines changed: 32 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -40,14 +40,14 @@ export async function seedQuestions() {
40
40
{
41
41
title: "Two Sum",
42
42
description:
43
-
"Given an array of integers `nums` (line 1) and an integer `target` (line 2), return indices of the two numbers in a list such that they add up to `target`. You may assume that each input would have **exactly one solution**, and you may not use the same element twice. The list should be returned in sorted order.",
43
+
"Given an array of integers `nums` and an integer `target`, find the indices of the two numbers in `nums` that add up to `target`. You may assume that each input has **exactly one solution**, and you cannot use the same element twice. Return the indices as a list sorted in ascending order.",
pythonTemplate: `# Please do not modify the main function\ndef main():\n\tprint(" ".join(solution()))\n\n\n# Write your code here\ndef solution():\n\treturn []\n\n\nif __name__ == "__main__":\n\tmain()\n`,
49
-
javaTemplate: `public class Main {\n // Please do not modify the main function\n public static void main(String[] args) {\n System.out.println(String.join(" ", solution()));\n }\n\n // Write your code here\n public static String[] solution() {\n return new String[]{};\n }\n}`,
50
-
cTemplate: `#include <stdio.h>\n\n// Function to implement\nconst char** solution() {\n static const char* result[] = {NULL}; // Placeholder\n return result;\n}\n\n// Please do not modify the main function\nint main() {\n const char** result = solution();\n for (int i = 0; result[i] != NULL; i++) {\n printf("%s ", result[i]);\n }\n printf("\\n");\n return 0;\n}`,
48
+
pythonTemplate: `# Please do not modify the main function\ndef main():\n\tnums = list(map(int, input().split()))\n\ttarget = int(input().strip())\n\tprint(" ".join(map(str, solution(nums, target))))\n\n\n# Write your code here\ndef solution(nums, target):\n\t# Implement your solution here\n\treturn []\n\n\nif __name__ == "__main__":\n\tmain()\n`,
49
+
javaTemplate: `import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class Main {\n // Please do not modify the main function\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n int target = scanner.nextInt();\n System.out.println(Arrays.toString(solution(nums, target)));\n }\n\n // Write your code here\n public static int[] solution(int[] nums, int target) {\n // Implement your solution here\n return new int[]{};\n }\n}`,
50
+
cTemplate: `#include <stdio.h>\n#include <stdlib.h>\n\n// Function to implement\nint* solution(int* nums, int numsSize, int target, int* returnSize) {\n *returnSize = 2; // Adjust as needed\n int* result = (int*)malloc(2 * sizeof(int));\n // Implement your solution here\n result[0] = -1; // Placeholder\n result[1] = -1; // Placeholder\n return result;\n}\n\n// Please do not modify the main function\nint main() {\n int n, target;\n scanf("%d", &n);\n int nums[n];\n for (int i = 0; i < n; i++) {\n scanf("%d", &nums[i]);\n }\n scanf("%d", &target);\n int returnSize;\n int* result = solution(nums, n, target, &returnSize);\n for (int i = 0; i < returnSize; i++) {\n printf("%d ", result[i]);\n }\n printf("\\n");\n free(result);\n return 0;\n}`,
51
51
},
52
52
{
53
53
title: "Longest Substring Without Repeating Characters",
@@ -102,6 +102,34 @@ export async function seedQuestions() {
102
102
javaTemplate: `import java.util.Scanner;\n\npublic class Main {\n // Please do not modify the main function\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.nextLine().trim();\n System.out.println(solution(s));\n }\n\n // Write your code here\n public static String solution(String s) {\n // Implement your solution here\n return "";\n }\n}`,
103
103
cTemplate: `#include <stdio.h>\n#include <string.h>\n\n// Function to implement\nconst char* solution(const char* s) {\n // Implement your solution here\n return "";\n}\n\n// Please do not modify the main function\nint main() {\n char s[1000];\n fgets(s, sizeof(s), stdin);\n s[strcspn(s, "\\n")] = 0; // Remove newline\n printf("%s\\n", solution(s));\n return 0;\n}`,
104
104
},
105
+
{
106
+
title: "ZigZag Conversion",
107
+
description:
108
+
"The string `PAYPALISHIRING` is written in a zigzag pattern on a given number of rows like this:\n\n"+
109
+
"```\n"+
110
+
"P A H N\n"+
111
+
"A P L S I I G\n"+
112
+
"Y I R\n"+
113
+
"```\n\n"+
114
+
"And then read line by line: `PAHNAPLSIIGYIR`.\n\n"+
115
+
"Write the code that will take a string and make this conversion given a number of rows.\n\n"+
116
+
"### Input\n"+
117
+
"Each test case consists of two lines:\n"+
118
+
"- The first line contains the string `s`.\n"+
119
+
"- The second line contains an integer `numRows`, representing the number of rows for the zigzag pattern.\n\n"+
120
+
"### Output\n"+
121
+
"For each test case, output the zigzag converted string as a single line.\n\n"+
122
+
"### Explanation\n"+
123
+
"- **Test Case 1**: `PAYPALISHIRING` with `numRows = 3` converts to `PAHNAPLSIIGYIR`.\n"+
124
+
"- **Test Case 2**: `PAYPALISHIRING` with `numRows = 4` converts to `HLOEL`.",
pythonTemplate: `# Please do not modify the main function\ndef main():\n\timport sys\n\tinput = sys.stdin.read().strip().split("\\n\\n")\n\tfor case in input:\n\t\tlines = case.split("\\n")\n\t\ts = lines[0]\n\t\tnumRows = int(lines[1])\n\t\tprint(solution(s, numRows))\n\n\n# Write your code here\ndef solution(s, numRows):\n\t# Implement your solution here\n\treturn ""\n\n\nif __name__ == "__main__":\n\tmain()\n`,
130
+
javaTemplate: `import java.util.*;\n\npublic class Main {\n // Please do not modify the main function\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.nextLine().trim();\n int numRows = Integer.parseInt(scanner.nextLine().trim());\n System.out.println(solution(s, numRows));\n }\n\n // Write your code here\n public static String solution(String s, int numRows) {\n // Implement your solution here\n return "";\n }\n}`,
131
+
cTemplate: `#include <stdio.h>\n#include <string.h>\n\n// Function to implement\nconst char* solution(const char* s, int numRows) {\n // Implement your solution here\n return "";\n}\n\n// Please do not modify the main function\nint main() {\n char s[1000];\n int numRows;\n fgets(s, sizeof(s), stdin);\n s[strcspn(s, "\\n")] = 0; // Remove newline\n scanf("%d", &numRows);\n printf("%s\\n", solution(s, numRows));\n return 0;\n}`,
0 commit comments