This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
A platform for hosting coding contests with a LeetCode-style interface.
The platform uses a driver code approach similar to LeetCode, where participants implement specific functions that are tested against test cases. This separates the implementation logic from input/output handling.
- Problem Statement:
Write a function `two_sum(nums, target)` that takes an array of integers and a target integer, and returns the indices of two numbers such that they add up to the target.
Example:
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Explanation: Because nums[0] + nums[1] = 2 + 7 = 9
- Starter Code:
def two_sum(nums, target):
# Your implementation here
pass- Driver Code:
def main():
# Parse input
lines = input_data.strip().split('\n')
nums = list(map(int, lines[0].replace('[', '').replace(']', '').split(',')))
target = int(lines[1])
# Call participant's function
result = two_sum(nums, target)
# Format and print output
print(result)
main()- Solution Code:
def two_sum(nums, target):
seen = {}
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
return []- Test Cases:
- Input:
[2,7,11,15]\n9 - Expected Output:
[0, 1]
- Input:
- Problem Statement:
Write a function `int[] twoSum(int[] nums, int target)` that takes an array of integers and a target integer, and returns the indices of two numbers such that they add up to the target.
- Starter Code:
class Solution {
public int[] twoSum(int[] nums, int target) {
// Your implementation here
return new int[0];
}
}- Driver Code:
public static void main(String[] args) {
// Parse input
String[] lines = input_data.trim().split("\\n");
String numStr = lines[0].replace("[", "").replace("]", "");
String[] numStrs = numStr.split(",");
int[] nums = new int[numStrs.length];
for (int i = 0; i < numStrs.length; i++) {
nums[i] = Integer.parseInt(numStrs[i].trim());
}
int target = Integer.parseInt(lines[1]);
// Call participant's solution
Solution solution = new Solution();
int[] result = solution.twoSum(nums, target);
// Format and print output
System.out.print("[");
for (int i = 0; i < result.length; i++) {
System.out.print(result[i]);
if (i < result.length - 1) {
System.out.print(", ");
}
}
System.out.println("]");
}When a participant submits their solution:
- The platform combines their code with the driver code
- For each test case, the driver code:
- Processes the test input
- Calls the participant's function with the processed input
- Formats the output from the participant's function
- Compares it with the expected output
This approach:
- Allows participants to focus on implementing algorithms
- Provides consistent testing across submissions
- Standardizes input/output handling
- Matches the experience on platforms like LeetCode, HackerRank, etc.