Skip to content

Instantly share code, notes, and snippets.

View claeusdev's full-sized avatar
🏠
Working from home

Nana Adjei Manu claeusdev

🏠
Working from home
View GitHub Profile
set relativenumber
set tabstop=4
set termguicolors
set nobackup
set nowritebackup
set encoding=utf-8
set nocompatible
filetype off
filetype plugin indent on

To address Problem B as described in your document, we'll start by identifying a counterexample to the provided greedy algorithm ("largest increment in mark"), then design an efficient algorithm to solve the homework allocation problem optimally, and finally analyze its time and space complexity.

Counterexample to the Greedy Algorithm

Let's consider the greedy algorithm provided in the problem statement, which prioritizes homework assignments based on the largest increase in marks for each additional hour spent. We need to find a scenario where this approach does not yield the maximum total marks when the total available hours (T) are limited, with (n \leq 2) and (T \leq 3).

Given:

  • (n = 2) homework assignments.
  • (T = 3) hours available.
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.Objects;
public class RoutePlannerAdapter implements IDUServiceRoutePlanner {
private final String apiKey;
import java.util.ArrayList;
import java.util.List;
public interface Address {
String getStreet();
String getCity();
String getPostalCode();
String getCountry();
}
function generateCode(){
return Math.floor(10000000 + Math.random() * 90000000)
// // Generate a version 4 (random) UUID
// const uuid = uuidv4();
// // Extract the first 8 characters to get an 8-digit ID
// const studentId = uuid.substring(0, 8);
// // call .toString() if you need it as a string.
}
@claeusdev
claeusdev / rails http status codes
Created October 31, 2023 18:20 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@claeusdev
claeusdev / design.md
Created September 5, 2023 21:56
Simple design for Writtr

Overview

This is a design template for a very simple multiblogging application. Saas with payments, newsletters, subscriptions.

MVP Scope

Basic functionality:

 1. User can sign up/sign in 
@claeusdev
claeusdev / index.md
Last active June 14, 2023 23:34
Assignment for better javascript/Typescript/React.

Assignment 1

We want to get/have access to all values stored in browser storage. Implement (complete) the hook below such that it meets the acceptance criteria. We want to have the ability to read, add and update values from the browser storage when the hook is called. Think about all the CRUD actions for each object returned from the useBrowserStorage() hook.

IMPLEMENATION NOTES

  1. for. v1 can be as poor as possible because we shall review and work on refactoring
  2. v2 consider better state management ( context, stateHooks, reducers )
Grid
Flex -
Transitions/Animations -
boxShadow: {
}
const Text {
@claeusdev
claeusdev / .zshrc
Created September 2, 2022 15:18 — forked from jednano/.zshrc
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export PATH="/usr/local/opt/python/bin:$PATH"
export GPG_TTY=$(tty)
# export START="$HOME/a"
# if [[ $PWD == $HOME ]]; then
# cd $START
# fi
# alias ls='ls -F --color --show-control-chars'