Skip to content

Instantly share code, notes, and snippets.

View topeogunleye's full-sized avatar
:octocat:
Looking for Job Opportunities

Temitope Ogunleye topeogunleye

:octocat:
Looking for Job Opportunities
View GitHub Profile
@topeogunleye
topeogunleye / package.json
Last active July 30, 2024 15:32
Package Version - Building a Modern React App with Vite, ESLint, and Prettier In VSCode
{
"name": "my-react-app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
@topeogunleye
topeogunleye / RAD-Internship-assignment.js
Created August 18, 2023 13:44
RAD-Internship-assignment.js
// You have an array.
// An item of the array has `name`, a string, and `types`, an array of strings.
// The length of `types` in a record can be 1-99 (not always 1-2)
// e.g. [{ name: "bulbasaur", types: ["grass", "poison"] }]
const pokes = getPokes();
console.log("Pokes", pokes);
// Problem 1: Filter by type
// - Populate `answer1` with Pokemon names that contain the type string
const type = "grass";
@topeogunleye
topeogunleye / findDuplicates.js
Created December 19, 2022 19:19
Find The Duplicates
function findDuplicates(arr1, arr2) {
// your code goes here
let i = 0
let j = 0
let duplicateArray = []
while (i < arr1.length && j < arr2.length) {
if (arr1[i] < arr2[j]) {
@topeogunleye
topeogunleye / gradingStudents.js
Last active August 19, 2022 13:39
Grading Students HackerRank
function gradingStudents(grades) {
grades.forEach((grade,index) => {
if (grade >= 38 && grade % 5 >= 3) {
grades[index] = grade + 5 - (grade % 5)
}
})
@topeogunleye
topeogunleye / gradingStudents.js
Created June 16, 2022 07:40
Grading Students
function gradingStudents(grades) {
// Write your code here
// if grades >= 40
// check if grade - next multiple of 5 is less than 3
// if less than 3 round
// else return grade unrounded
let results = []
function getNearestMultiple(number, multiple) {
@topeogunleye
topeogunleye / pancakeSort.js
Created May 26, 2022 07:31
Pancake Sort Pramp Interviews
function pancakeSort(arr) {
// code goes here
function flip(arr, k) {
let arrItem1 = 0;
let arrItemK = k;
while (arrItem1 < arrItemK){
let temp = arr[arrItem1];
arr[arrItem1] = arr[arrItemK]
arr[arrItemK] = temp;
@topeogunleye
topeogunleye / twoSum.js
Created May 19, 2022 07:33
Two Sum LeetCode Challenge
/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
const twoSums = [0,0];
for (let i = 0; i < nums.length; i++) {
for (let j = i + 1; j < nums.length; j++) {
@topeogunleye
topeogunleye / lonelyInteger.js
Created May 10, 2022 08:08
Lonely Integer HackerRank Challenge
function lonelyinteger(a) {
// Write your code here
let len = a.length;
if (len == 1) {
return 1
}
let sorted_arr = a.sort();
@topeogunleye
topeogunleye / timeConversion.js
Created May 6, 2022 07:12
Time Conversion HackerRank Challenge
function timeConversion(s) {
// Write your code here
// if hour is 12am, return 00
// if hour is between 1am to 11:59am, return 1 to 11:59
// if time is 12pm, return 12
// if hour is between 1pm to 11:59pm, return 1 + 12 to 11:59 + 12
// Military Hour
@topeogunleye
topeogunleye / plusMinus.js
Last active May 3, 2022 07:28
Plus Minus HackerRank Challenge
function plusMinus(arr) {
// Write your code here
let positives = 0;
let negatives = 0;
let zeros = 0;
for (let i = 0; i < arr.length; i++) {
if (arr[i] > 0) {
positives++
} else if (arr[i] < 0) {