Skip to content

Commit 3bcab66

Browse files
Create dummy data for testing
1 parent 63ec9e7 commit 3bcab66

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

frontend/src/data/sampleqn.tsx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Question } from "../models/Quesiton.model";
2+
3+
const dummy = [
4+
[1, "Reverse a string", ["t2", "t3"], 0.1, "dummy 1"],
5+
[
6+
2,
7+
"Linked List Cycle Detection",
8+
["t", "t2", "t3"],
9+
0.51,
10+
"# Dummy question descr \n ## kasodifjas \n asdfasdfa \n asdfsdf",
11+
],
12+
[3, "Roman to Integer", ["t", "t2"], 0.92, "dummy 3"],
13+
[4, "Add Binary", ["t", "t2", "t3"], 1.33, "dummy 4"],
14+
[5, "Fibocacci Number", ["t3"], 1.74, "dummy 5"],
15+
[6, "Implement Stack using Queues", ["t", "t2", "t3"], 2.15, "dummy 6"],
16+
[7, "Combine Two Tables", ["t", "t2", "t3"], 2.56, "dummy 7"],
17+
[8, "Repeated DNA Sequences", ["t", "t2", "t3"], 2.97, "dummy 8"],
18+
[9, "Course Schedule", ["t", "t2", "t3"], 3.38, "dummy 9"],
19+
[10, "LRU Cache Design", ["t", "t2", "t3"], 3.79, "dummy 10"],
20+
[11, "Longest Common Subsequence", ["t", "t2", "t3"], 4.2, "dummy 11"],
21+
[12, "Rotate Image", ["t", "t2", "t3"], 4.61, "dummy 12"],
22+
[
23+
13,
24+
"Airplace Seat Assignment Probability",
25+
["t", "t2", "t3"],
26+
5.02,
27+
"dummy 13",
28+
],
29+
[14, "Validate Binary Search Tree", ["t", "t2", "t3"], 5.43, "dummy 14"],
30+
[15, "Sliding Window Maximum", ["t", "t2", "t3"], 5.84, "dummy 15"],
31+
[16, "N-Queen Problem", ["t", "t2", "t3"], 6.25, "dummy 16"],
32+
[
33+
17,
34+
"Serialize and Deseralize a Binary Tree",
35+
["t", "t2", "t3"],
36+
6.66,
37+
"dummy 17",
38+
],
39+
[18, "Wildcard Matching", ["t", "t2", "t3"], 7.07, "dummy 18"],
40+
[19, "Chalkboard XOR Game", ["t", "t2", "t3"], 7.48, "dummy 19"],
41+
[20, "Trips and Users", ["t", "t3"], 7.89, "dummy 20"],
42+
];
43+
44+
export const dummyQn = dummy.map(
45+
//@ts-ignore
46+
(x) => new Question(x[0], x[1], x[4], x[2], x[3])
47+
);
48+
49+
export const dummyQnLookup = new Map<string, Question>(
50+
dummyQn.map((x) => [x.id.toString(), x])
51+
);
52+
53+
export const deleteDummyQn = (id: number) => {
54+
dummyQnLookup.delete(id.toString());
55+
const res = dummyQn.findIndex((qn) => qn.id === id);
56+
if (res != -1) dummyQn.splice(res, 1);
57+
};
58+
59+
export const createDummyQn = (qn: Question) => {
60+
let newid = -1;
61+
for (let qn of dummyQn) {
62+
newid = Math.max(newid, qn.id);
63+
}
64+
newid += 1;
65+
qn.id = newid;
66+
dummyQn.push(qn);
67+
dummyQnLookup.set(newid.toString(), qn);
68+
};

0 commit comments

Comments
 (0)