Skip to content

Commit

Permalink
Rename categories to topics
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelim01 committed Sep 16, 2024
1 parent 7a3db93 commit 2171c15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions services/question/src/data/questions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,140 +3,140 @@
"id": 1,
"title": "Reverse a String",
"description": "Write a function that reverses a string. The input string is given as an array of characters s.\n\nYou must do this by modifying the input array in-place with O(1) extra memory.\n\n\nExample 1:\n\nInput: s = [\"h\",\"e\",\"l\",\"l\",\"o\"]\nOutput: [\"o\",\"l\",\"l\",\"e\",\"h\"]\n\nExample 2:\nInput: s = [\"H\",\"a\",\"n\",\"n\",\"a\",\"h\"]\nOutput: [\"h\",\"a\",\"n\",\"n\",\"a\",\"H\"]\n\nConstraints:\n1 <= s.length <= 105 s[i] is a printable ascii character.",
"categories": ["Strings", "Algorithms"],
"topics": ["Strings", "Algorithms"],
"difficulty": "Easy"
},
{
"id": 2,
"title": "Linked List Cycle Detection",
"description": "Implement a function to detect if a linked list contains a cycle.",
"categories": ["Data Structures", "Algorithms"],
"topics": ["Data Structures", "Algorithms"],
"difficulty": "Easy"
},
{
"id": 3,
"title": "Roman to Integer",
"description": "Given a roman numeral, convert it to an integer.",
"categories": ["Algorithms"],
"topics": ["Algorithms"],
"difficulty": "Easy"
},
{
"id": 4,
"title": "Add Binary",
"description": "Given two binary strings a and b, return their sum as a binary string.",
"categories": ["Bit Manipulation", "Algorithms"],
"topics": ["Bit Manipulation", "Algorithms"],
"difficulty": "Easy"
},
{
"id": 5,
"title": "Fibonacci Number",
"description": "The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,\n\nF(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n - 2), for n > 1.\n\nGiven n, calculate F(n).",
"categories": ["Recursion", "Algorithms"],
"topics": ["Recursion", "Algorithms"],
"difficulty": "Easy"
},
{
"id": 6,
"title": "Implement Stack using Queues",
"description": "Implement a last-in first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty).",
"categories": ["Data Structures"],
"topics": ["Data Structures"],
"difficulty": "Easy"
},
{
"id": 7,
"title": "Combine Two Tables",
"description": "Given table Person with the following columns:\n1. personId (int)\n2. lastName (varchar)\n3. firstName (varchar)\npersonId is the primary key.\n\nAnd table Address with the following columns:\n1. addressId (int)\n2. personId (int)\n3. city (varchar)\n4. state (varchar)\naddressId is the primary key.\n\nWrite a solution to report the first name, last name, city, and state of each person in the Person table. If the address of a personId is not present in the Address table, report null instead. Return the result table in any order.",
"categories": ["Databases"],
"topics": ["Databases"],
"difficulty": "Easy"
},
{
"id": 8,
"title": "Repeated DNA Sequences",
"description": "The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.\n\nFor example, \"ACGAATTCCG\" is a DNA sequence. When studying DNA, it is useful to identify repeated sequences within the DNA.\n\nGiven a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in any order.",
"categories": ["Algorithms", "Bit Manipulation"],
"topics": ["Algorithms", "Bit Manipulation"],
"difficulty": "Medium"
},
{
"id": 9,
"title": "Course Schedule",
"description": "There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai.\n\nFor example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return false.",
"categories": ["Data Structures", "Algorithms"],
"topics": ["Data Structures", "Algorithms"],
"difficulty": "Medium"
},
{
"id": 10,
"title": "LRU Cache Design",
"description": "Design and implement an LRU (Least Recently Used) cache.",
"categories": ["Data Structures"],
"topics": ["Data Structures"],
"difficulty": "Medium"
},
{
"id": 11,
"title": "Longest Common Subsequence",
"description": "Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0.\n\nA subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.\n\nFor example, \"ace\" is a subsequence of \"abcde\". A common subsequence of two strings is a subsequence that is common to both strings.",
"categories": ["Strings", "Algorithms"],
"topics": ["Strings", "Algorithms"],
"difficulty": "Medium"
},
{
"id": 12,
"title": "Rotate Image",
"description": "You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).",
"categories": ["Arrays", "Algorithms"],
"topics": ["Arrays", "Algorithms"],
"difficulty": "Medium"
},
{
"id": 13,
"title": "Airplane Seat Assignment Probability",
"description": "n passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of the passengers will:\nTake their own seat if it is still available, and Pick other seats randomly when they find their seat occupied\n\nReturn the probability that the nth person gets his own seat.",
"categories": ["Brainteaser"],
"topics": ["Brainteaser"],
"difficulty": "Medium"
},
{
"id": 14,
"title": "Validate Binary Search Tree",
"description": "Given the root of a binary tree, determine if it is a valid binary search tree (BST).",
"categories": ["Data Structures", "Algorithms"],
"topics": ["Data Structures", "Algorithms"],
"difficulty": "Medium"
},
{
"id": 15,
"title": "Sliding Window Maximum",
"description": "You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.\n\nReturn the max sliding window.",
"categories": ["Arrays", "Algorithms"],
"topics": ["Arrays", "Algorithms"],
"difficulty": "Hard"
},
{
"id": 16,
"title": "N-Queen Problem",
"description": "The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.\n\nGiven an integer n, return all distinct solutions to the n queens puzzle. You may return the answer in any order.\n\nEach solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space, respectively.",
"categories": ["Algorithms"],
"topics": ["Algorithms"],
"difficulty": "Hard"
},
{
"id": 17,
"title": "Serialize and Deserialize a Binary Tree",
"description": "Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.\n\nDesign an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserializ ation 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.",
"categories": ["Data Structures", "Algorithms"],
"topics": ["Data Structures", "Algorithms"],
"difficulty": "Hard"
},
{
"id": 18,
"title": "Wildcard Matching",
"description": "Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where:\n\n'?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence).\nThe matching should cover the entire input string (not partial).",
"categories": ["Strings", "Algorithms"],
"topics": ["Strings", "Algorithms"],
"difficulty": "Hard"
},
{
"id": 19,
"title": "Chalkboard XOR Game",
"description": "You are given an array of integers nums represents the numbers written on a chalkboard.\n\nAlice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first. If erasing a number causes the bitwise XOR of all the elements of the chalkboard to become 0, then that player loses. The bitwise XOR of one element is that element itself, and the bitwise XOR of no elements is 0.\n\nAlso, if any player starts their turn with the bitwise XOR of all the elements of the chalkboard equal to 0, then that player wins.\n\nReturn true if and only if Alice wins the game, assuming both players play optimally.",
"categories": ["Brainteaser"],
"topics": ["Brainteaser"],
"difficulty": "Hard"
},
{
"id": 20,
"title": "Trips and Users",
"description": "Given table Trips:\n1. id (int)\n2. client_id (int)\n3. driver_id (int)\n4. city_id (int)\n5. status (enum)\n6. request_at(da te)\nid is the primary key.\nThe table holds all taxi trips. Each trip has a unique id, while client_id and driver_id are foreign keys to the users_id at the Users table. Status is an ENUM (category) type of ('completed', 'cancelled_by_driver', 'cancelled_by_client').\n\nAnd table Users:\n1. users_id (int)\n2. banned (enum)\n3. role (enum)\nusers_id is the primary key (column with unique values) for this table. The table holds all users. Each user has a unique users_id, and role is an ENUM type of ('client', 'driver', 'partner'). banned is an ENUM (category) type of ('Yes', 'No'). The cancellation rate is computed by dividing the number of canceled (by client or driver) requests with unbanned users by the total number of requests with unbanned users on that day.\n\nWrite a solution to find the cancellation rate of requests with unbanned users (both client and driver must not be banned) each day between \"2013-10-01\" and \"2013-10-03\". Round Cancellation Rate to two decimal points.\n\nReturn the result table in any order.",
"categories": ["Databases"],
"topics": ["Databases"],
"difficulty": "Hard"
}
]
4 changes: 2 additions & 2 deletions services/question/src/models/questionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface IQuestion {
id: number;
title: string;
description: string;
categories: [string];
topics: [string];
difficulty: Difficulty;
}

Expand All @@ -30,7 +30,7 @@ const questionSchema = new Schema<IQuestion>(
type: String,
required: true,
},
categories: {
topics: {
type: [String],
required: true,
},
Expand Down

0 comments on commit 2171c15

Please sign in to comment.