Competitive Coding with JavaScript: Your Complete Setup Guide in Sublime Text 3
Sk Abir Ahmed
Full Stack Developer || Pursuing B.tech in CSE @Bengal Institute Of Technology || C# || Node Js || Java || C++
Hey LinkedIn Family! ??
Today, I want to share something valuable for all the JavaScript developers who want to dive into competitive coding without switching to C++, Java or Python.
Competitive coding is super popular, and we know C++ is often the go-to language for it because of its speed and control. But what about those of us who are more comfortable with JavaScript? ??No worries! You can set up an efficient JavaScript environment in Sublime Text just like C++ coders use CppFastOlympicCoding package in sublime text. Let me walk you through the process.
Steps to Set Up:
{
"shell_cmd": "node script.js < input.in > output.out",
"selector": "source.js",
"working_dir": "${file_path}",
"path": "C:\\Program Files\\nodejs"
}
// Change the file path and file name accordingly
Running the Code:
领英推荐
Sample Code (Explain with Comments):
// Set encoding to UTF-8
process.stdin.setEncoding('utf8');
// Initialize an empty string to store inputs
let inputs = "";
// Collect input data
process.stdin.on("data", (data) => {
inputs += data;
});
// Once input is complete, process it
process.stdin.on("end", () => {
// Split input by lines and trim whitespace
let input = inputs.trim().split("\n");
// First line is the number of test cases
let testcase = parseInt(input[0]);
// Iterate over each test case
for (let i = 1; i <= testcase; ++i) {
// Parse x and y from input
let [x, y] = input[i].trim().split(" ").map(Number);
// Output x and y (replace this with your logic)
console.log(x, y);
}
});
Conclusion:
#JavaScript #CompetitiveCoding #SublimeText #NodeJS #TechTutorial #CodingSetup #CodingCommunity
CSE'25 | MERN developer | Google DSC Lead '23 | GSSOC'23 | Web3 Dev | Learning Flutter in DApps
6 个月Awesome a great starting guide?