Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
McLarenCollege / foundationsSyllabus.md
Last active December 26, 2022 21:29
Foundations Syllabus

Foundations Course Syllabus

  • Basic Data Types and Operators (String, Number, +, -)
  • Variables (Declaration, Assignment, Naming rules)
  • Compound Expressions (%, ++, --, +=)
  • Boolean data type and logical operators (or, and, not)
  • If/else and Ternary Operator
  • Functions
  • Arrays and Loops
  • Objects
  • Array and String Methods
@McLarenCollege
McLarenCollege / Anagrams-part-2.md
Last active November 28, 2022 09:38
Exercise : Anagrams Part 2

Write a function that accepts two strings and checks if the first string is an anagram of the second string. If they are anagrams it returns true, otherwise it returns false. The case(upper/lower) of the characters DOES NOT MATTER.

function checkAnagram(word1, word2){
 // write your code here
}
console.log(checkAnagram("silent", "liSten")); // true
console.log(checkAnagram("stressed", "DesertsS")); // true
@McLarenCollege
McLarenCollege / ticketPriceChildAdult.md
Last active November 24, 2022 14:08
Ticket Price Child Adult

Given a person's age and a day ,write the code for the following scenario:

If the person is an Adult (age >=18) , the ticket price on Weekends is 100 and on weekdays is 80.

If the person is a child (age <18), the ticket price is always half of the adult price for that particular day.

CODE TEMPLATE


@McLarenCollege
McLarenCollege / zipIt.md
Last active October 6, 2022 11:58
Exercise : Zip It

Zip It

Write a function called zipIt that accepts two already sorted arrays and returns a new array which contains all the elements present in both the arrays in a sorted order.

  • Note: Do not use a sorting algorithm

Eg.

zipIt([1,5,9,10], [2,4,7])
@McLarenCollege
McLarenCollege / bubbleSortAlgorithm.md
Last active September 29, 2022 07:44
Exercise : Bubble Sort Steps

Bubble Sort Algorithm

Stepwise Implementation of the Bubble Sort Algorithm

If the input is [6,2,9,5,1,3] the steps are:

compare 6 and 2 - swap
compare 6 and 9 - no change
@McLarenCollege
McLarenCollege / bubbleSortAlgorithm.md
Last active September 28, 2022 05:51
Exercise : Bubble Sort Algorithm

Write a function that sorts a given array using the Bubble Sort Algorithm and returns the sorted Array. For eg.

bubbleSort([1,5,3,0])

should return [0,1,3,5]

bubbleSort([-1,0,-5,5,8])

should return [-5,-1,0,5,8]

@McLarenCollege
McLarenCollege / setupInstructionsFoundationsCourse.md
Last active July 14, 2022 12:23
Set Up Instructions for Foundations Course

Set Up Instructions

  • Complete the set up by or before the deadline mentioned in the enrollment email

  • If you have any problem in the set up you must tell us on Discord along with a clear description of the problem.

1. Set Up VSCode and Nodejs

  • Watch this video to setup Github and other things and make sure to use your first and last name in your GitHub Profile.
  • Please install the appropriate version of VSCode on your computer.
  • Install NodeJS on your computer.

for Windows

@McLarenCollege
McLarenCollege / ticketPriceUsingIfElseIfPart1Solution.md
Created July 6, 2022 07:23
Ticket Price Using If Else If Part1 Solution
let age = 23;
let day = 'Monday';
let price;
if (age <= 12) {
    price = 50;
}
if (age >= 65) {
    if (day === 'Saturday' || day === 'Sunday') {
 price = 70;
@McLarenCollege
McLarenCollege / boxesInRows.md
Last active March 17, 2022 09:23
Count the number of boxes in each row

There is an array of boxes where each element of an array represents the number of boxes stacked on top of each other in that column. For eg. boxes=[4,1,2,3,2,1].

This is a row of boxes where the first column of boxes has 4 boxes stacked on top of each other. The second column has 1 box, the third column has 2 boxes stacked on top of each other and the fourth column has 3 boxes stacked on top of each other and so on. So the boxes look like this:

              B
              B     B
 B B B B