- Coding Beauty
- Posts
- Learn these algorithms now to get into lucrative freelance networks
Learn these algorithms now to get into lucrative freelance networks
You won't pass the coding stage without these
Upgrade to Coding Beauty Premium to join our Discord community and enjoy unlimited access to monthly workshops covering crucial topics ranging from exclusive freelance networks, shadcn/ui, VS Code overhauls, clean code techniques, AI automation, and more. Get Premium
New puzzle to train your brain and test your coding understanding✨
Featured content
Exclusive freelance networks are an incredible way to gain consistent access to dozens of new lucrative clients.
But there’s a catch — they’re exclusive — it’s tough to get in.
It’s definitely worth it, but you’ll need to go through a grilling multi-stage process to be accepted into most of them.
Now coding quizzes are a core stage, and algorithm knowledge is crucial for you to go through.
Check these out and find out which areas you need to work on to maximize your chances of gaining entry.
The coding questions are an awesome way to test your algorithmic skills.
1. Classic iteration
Standard stuff.
How to implement complex logic and output with while, do..while and for loops.
Common questions
How to:
Create shapes and structures with asterisks — like a right-angle triangle, or a pizza slice.
Print Fibonacci numbers until n
Print sum of numbers until n
function printFibonacci(n) {
let a = 0, b = 1, temp;
for (let i = 0; i < n; i++) {
console.log(a);
temp = a + b;
a = b;
b = temp;
}
}
printFibonacci(10);
2. Arrays
Lists are everywhere in life and code.
If you want to have any chance at the algorithms you'll meet, you need to know the in's and out's of inspecting and manipulating them.
Iteration, calculating sums, finding elements.
Common questions
Find the maximum value in an array.
Calculate the sum of all elements.
Rotate an array.
Find the second largest element.
Merge two sorted arrays.
function rotateArray(arr, k) {
const n = arr.length;
k = k % n; // in case k is greater than array length
return arr.slice(-k).concat(arr.slice(0, n - k));
}
// Example
let arr = [1, 2, 3, 4, 5];
let k = 2;
let rotatedArr = rotateArray(arr, k);
console.log(rotatedArr); // Output: [4, 5, 1, 2, 3]
There’s so much more to arrays than map()
, filter()
, find()
, and push()
.
But most devs are completely clueless about this — several powerful methods they’re missing out on.
Check these out:
1. copyWithin()
Array
copyWithin()
copies a part of an array to another position in the same array and returns it without increasing its length.
const array = [1, 2, 3, 4, 5];
// copyWithin(target, start, end)
// replace arr with start..end at target
// a. target -> 3 (index)
// b. start -> 1 (index)
// c. end -> 3 (index)
// start..end -> 2, 3
const result = array.copyWithin(3, 1, 3);
console.log(result); // [1, 2, 3, 2, 3]
end
parameter is optional:
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// "end" not specified so last array index used
// target -> 0 (index)
// start..end -> 6, 7, 8, 9, 10
const result = array.copyWithin(0, 5);
// [6, 7, 8, 9, 10, 6, 7, 8, 9, 10]
console.log(result);
const array = [1, 2, 3, 4, 5];
// Copy numbers 2, 3, 4, and 5 (cut off at index 4)
const result = array.copyWithin(3, 1, 6);
console.log(result); // [1, 2, 3, 2, 3]
2. at() and with()
at()
came first and with()
came a year after that in 2023.
They are the functional and immutable versions of single-element array modification and access.
const colors = ['pink', 'purple', 'red', 'yellow'];
console.log(colors.at(1)); // purple
console.log(colors.with(1, 'blue'));
// ['pink', 'blue', 'red', 'yellow']
// Original not modified
console.log(colors);
// ['pink', 'purple', 'red', 'yellow']
I stumbled upon something atrocious when coding the other day.
Do you see it?
Let’s zoom in a bit more:
This line:
Please don’t do this in any language.
Don’t await
properties.
You’re destroying your code readability and ruining the whole concept of OOP.
Properties are features not actions.
They don’t do like methods. They are.
They are data holders representing states of an object.
Simple states:
Writer RAG tool: build production-ready RAG apps in minutes
RAG in just a few lines of code? We’ve launched a predefined RAG tool on our developer platform, making it easy to bring your data into a Knowledge Graph and interact with it with AI. With a single API call, writer LLMs will intelligently call the RAG tool to chat with your data.
Integrated into Writer’s full-stack platform, it eliminates the need for complex vendor RAG setups, making it quick to build scalable, highly accurate AI workflows just by passing a graph ID of your data as a parameter to your RAG tool.
Thanks for taking the time to read today’s issue.
Don’t let the bugs byte,
The Coding Beauty team