Git Product home page Git Product logo

Prince Donkor's Projects

reverse-linked-list icon reverse-linked-list

Write a function that takes in the head of a Singly Linked List (assume that the list has at least 1 node; in other words, the head will never be a null value). The function should reverse the list and return its new head. Note that every node in the Singly Linked List has a "value" property storing its value as well as a "next" property pointing to the next node in the list or None (null) if it is the tail of the list. Sample input: 0 -> 1 -> 2 -> 3 -> 4 -> 5 (the head node with value 0) Sample output: 5 -> 4 -> 3 -> 2 -> 1 -> 0 (the new head node with value 5)

river-sizes icon river-sizes

Write a function that returns an array of the sizes of all rivers represented in the input matrix.

same-bst icon same-bst

An array of integers is said to represent the Binary Search Tree (BST) obtained by inserting each integer in the array (from left to right) into the BST. Write a function that takes in two arrays of integers and returns a boolean representing whether or not these arrays represent the same BST. Note that you are not allowed to construct any BSTs in your code. A BST is a Binary Tree that consists only of BST nodes. A node is said to be a BST node if and only if it satisfies the BST property: its value is strictly greater than the values of every node to its left; its value is less than or equal to the values of every node to its right; and both of its children nodes are either BST nodes themselves or None (null) values.

search-for-range icon search-for-range

Write a function that takes in a sorted array of integers as well as a target integer. The function should use a variation of the Binary Search algorithm to find a range of indices in between which the target number is contained in the array and should return this range in the form of an array. The first number in the output array should represent the first index at which the target number is located while the second number should represent the last index at which the target number is located. The function should return [-1, -1] if the number is not contained in the array. Sample input: [0, 1, 21, 33, 45, 45, 45, 45, 45, 45, 61, 71, 73], 45 Sample output: [4, 9]

search-in-sorted-matrix icon search-in-sorted-matrix

Given a sorted matrix write a function that returns an array of the row and column indices of the target number

selected-sort icon selected-sort

write a function that takes in an array of integers and returns a sorted version of that array, use the selection sort algorithm to sort the array

session icon session

Simple session middleware for Express

shifted-binary-search icon shifted-binary-search

Write a function that takes in a sorted array of integers as well as a target integer. The caveat is that the numbers in the array have been shifted by some amount; in other words, they have been moved to the left or the right by one or more positions. For example, [1, 2, 3, 4] might become [3, 4, 1, 2]. The function should use a variation of the Binary Search algorithm to find if the target number is contained in the array and should return its index if it is, otherwise -1. Sample input: [45, 61, 71, 72, 73, 0, 1, 21, 33, 45], 33 Sample output: 8

smallest-difference icon smallest-difference

Write a function that takes in two arrays and finds the pair of numbers whose absolute difference is closest to zero.

subarray-sort icon subarray-sort

Write a function that takes in an array of numbers and returns an array of the starting and ending indices of the smallest subarray in the input array that needs to be sorted in place in order for the entire input array to be sorted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.