Skip to content

Commit fc2dec4

Browse files
committed
Update question controller and seed file
1 parent 4251e82 commit fc2dec4

File tree

2 files changed

+25
-41
lines changed

2 files changed

+25
-41
lines changed

backend/question-service/src/controllers/questionController.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,19 @@ export const readCategories = async (
257257
// message: CATEGORIES_RETRIEVED_MESSAGE,
258258
// categories: sortAlphabetically(uniqueCats),
259259
// });
260-
res
261-
.status(200)
262-
.json({
263-
message: CATEGORIES_RETRIEVED_MESSAGE,
264-
categories: [
265-
"Strings",
266-
"Algorithms",
267-
"Data Structures",
268-
"Bit Manipulation",
269-
"Recursion",
270-
"Databases",
271-
"Arrays",
272-
"Brainteaser",
273-
],
274-
});
260+
res.status(200).json({
261+
message: CATEGORIES_RETRIEVED_MESSAGE,
262+
categories: sortAlphabetically([
263+
"Strings",
264+
"Algorithms",
265+
"Data Structures",
266+
"Bit Manipulation",
267+
"Recursion",
268+
"Databases",
269+
"Arrays",
270+
"Brainteaser",
271+
]),
272+
});
275273
} catch (error) {
276274
res.status(500).json({ message: SERVER_ERROR_MESSAGE, error });
277275
}

backend/question-service/src/scripts/seed.ts

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,98 +11,84 @@ export async function seedQuestions() {
1111
description:
1212
"Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure. \n\n![image](https://firebasestorage.googleapis.com/v0/b/peerprep-c3bd1.appspot.com/o/07148757-21b2-4c20-93e0-d8bef1b3560d?alt=media)",
1313
complexity: "Hard",
14-
category: ["Tree", "Design"],
14+
category: ["Tree"],
1515
},
1616
{
1717
title: "Two Sum",
1818
description:
1919
"Given an array of integers `nums` and an integer `target`, return indices of the two numbers 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. You can return the answer in any order.",
2020
complexity: "Easy",
21-
category: ["Array", "Hash Table"],
22-
},
23-
{
24-
title: "Add Two Numbers",
25-
description:
26-
"You are given two non-empty linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself.",
27-
complexity: "Medium",
28-
category: ["Linked List", "Math"],
21+
category: ["Arrays"],
2922
},
3023
{
3124
title: "Longest Substring Without Repeating Characters",
3225
description:
3326
"Given a string `s`, find the length of the **longest substring** without repeating characters.",
3427
complexity: "Medium",
35-
category: ["Hash Table", "Two Pointers", "String", "Sliding Window"],
28+
category: ["Strings"],
3629
},
3730
{
3831
title: "Median of Two Sorted Arrays",
3932
description:
4033
"Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return the median of the two sorted arrays.",
4134
complexity: "Hard",
42-
category: ["Array", "Binary Search", "Divide and Conquer"],
35+
category: ["Arrays"],
4336
},
4437
{
4538
title: "Longest Palindromic Substring",
4639
description:
4740
"Given a string `s`, return the **longest palindromic substring** in `s`.",
4841
complexity: "Medium",
49-
category: ["String", "Dynamic Programming"],
42+
category: ["Strings", "Dynamic Programming"],
5043
},
5144
{
5245
title: "ZigZag Conversion",
5346
description:
5447
"The string `PAYPALISHIRING` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `PAHNAPLSIIGYIR` Write the code that will take a string and make this conversion given a number of rows.",
5548
complexity: "Medium",
56-
category: ["String"],
49+
category: ["Strings"],
5750
},
5851
{
5952
title: "Reverse Integer",
6053
description:
6154
"Given a signed 32-bit integer `x`, return `x` with its digits reversed. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-2^31, 2^31 - 1]`, then return 0.",
6255
complexity: "Easy",
63-
category: ["Math"],
56+
category: ["Strings"],
6457
},
6558
{
6659
title: "String to Integer (atoi)",
6760
description:
6861
"Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).",
6962
complexity: "Medium",
70-
category: ["Math", "String"],
71-
},
72-
{
73-
title: "Palindrome Number",
74-
description:
75-
"Given an integer `x`, return `true` if `x` is a palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, `121` is palindrome while `123` is not.",
76-
complexity: "Easy",
77-
category: ["Math"],
63+
category: ["Strings"],
7864
},
7965
{
8066
title: "Regular Expression Matching",
8167
description:
8268
"Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where: - `'.'` Matches any single character.​​​​ - `'*'` Matches zero or more of the preceding element.",
8369
complexity: "Hard",
84-
category: ["String", "Dynamic Programming", "Backtracking"],
70+
category: ["Strings", "Dynamic Programming"],
8571
},
8672
{
8773
title: "Container With Most Water",
8874
description:
8975
"Given `n` non-negative integers `a1, a2, ..., an`, where each represents a point at coordinate `(i, ai)`. `n` vertical lines are drawn such that the two endpoints of the line `i` is at `(i, ai)` and `(i, 0)`. Find two lines, which, together with the x-axis forms a container, such that the container contains the most water.",
9076
complexity: "Medium",
91-
category: ["Array", "Two Pointers"],
77+
category: ["Arrays"],
9278
},
9379
{
9480
title: "Integer to Roman",
9581
description:
9682
"Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. Given an integer, convert it to a roman numeral.",
9783
complexity: "Medium",
98-
category: ["Math", "String"],
84+
category: ["Strings"],
9985
},
10086
{
10187
title: "Roman to Integer",
10288
description:
10389
"Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. Given a roman numeral, convert it to an integer.",
10490
complexity: "Easy",
105-
category: ["Math", "String"],
91+
category: ["Strings"],
10692
},
10793
];
10894

0 commit comments

Comments
 (0)