Skip to content

Instantly share code, notes, and snippets.

View orozCoding's full-sized avatar
💻
Working remotely

Angel Orozco orozCoding

💻
Working remotely
View GitHub Profile
@orozCoding
orozCoding / dayOfProgrammer.js
Last active July 22, 2022 00:45
HackerRank Day of the Programmer
function dayOfProgrammer(year) {
// Write your code here
if (year === 1918) {
return '26.09.1918';
}
const checkLeapYear = (year) => {
if (year >= 1919) {
if (year % 400 === 0) {
return true;
@orozCoding
orozCoding / migratoryBird.js
Last active June 17, 2022 10:45
Migratory Birds - Hacker Rank
https://www.hackerrank.com/challenges/migratory-birds/problem?isFullScreen=true
const migratoryBird = (arr) => {
let i = 0;
let x = -1;
let splitedArr = [];
arr.sort((a,b) => (a-b))
while ( i < arr.length ) {
@orozCoding
orozCoding / birthday
Last active June 2, 2022 07:44
HackerRank Birthday challenge
https://www.hackerrank.com/challenges/the-birthday-bar/problem?isFullScreen=true
function birthday(s, d, m) {
// Write your code here
if ( s.length === 1 ) {
if (s[0] === d) {
return 1
}
}
function divisibleSumPairs(n, k, ar) {
// Write your code here
let total = 0;
let x = 0;
for (let x = 0; x < ar.length + 1; x++) {
for (let i = 0; i < ar.length; i++) {
if (i !== x) {
if ((ar[x] + ar[i]) % k === 0) {
total += 1;
@orozCoding
orozCoding / simple_quicksort.rb
Created May 13, 2022 07:00
Simple Quicksort in Ruby
def simple_quicksort(array)
# write your code here
return if array.empty?
final = []
pivot = array.first
left = []
right = []
@orozCoding
orozCoding / gradingStudents.js
Created April 29, 2022 16:03
JS - Grading Students - HackerRank
const gradingStudents = (grades) => {
let scores = [];
for (let i = 0; i < grades.length; i++) {
if (grades[i] < 38) {
scores.push(grades[i])
continue;
}
const groupAnagrams = (strs) => {
let copyArr = [...strs]
let finalArr = [];
for (let i = 0; i < copyArr.length; i++) {
copyArr[i] = copyArr[i].split("").sort().join("");
}
while (strs.length > 0) {
let i = 0;
@orozCoding
orozCoding / kangaroo.js
Created April 29, 2022 07:43
Number Line Jumps - HackerRank
const kangaroo = (x1, v1, x2, v2) => {
let start1 = x1 + v1
let start2 = x2 + v2
if (start1 === start2) {
return 'YES'
}
for (let i = 0 ; i <= 10000 ; i++ ) {
if((start1 + v1) === (start2 + v2)) {
@orozCoding
orozCoding / countApplesAndOranges.js
Created April 29, 2022 07:23
Apple and Orange - HackerRank
const countApplesAndOranges = (s, t, a, b, apples, oranges) => {
let applesInside = 0;
let orangesInside = 0;
for(let i = 0 ; i < apples.length ; i++) {
if ((apples[i] + a) >= s && (apples[i] + a) <= t ) {
applesInside += 1;
}
}