Skip to content

Instantly share code, notes, and snippets.

View Oyedee's full-sized avatar
🎯
Focusing

Hamid Oyempemi Oyedee

🎯
Focusing
View GitHub Profile
@Oyedee
Oyedee / README.md
Created February 12, 2025 21:45 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Oyedee
Oyedee / main.dart
Created October 27, 2023 09:24
Counting Bits - Leetcode 8
//Counting Bits - Bit manipulation
// Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.
// Example 1:
// Input: n = 2
// Output: [0,1,1]
// Explanation:
// 0 --> 0
@Oyedee
Oyedee / main.dart
Last active October 26, 2023 13:23
Range Sum Query - Leetcode 7 
//Question 7 - Dynamic programming
// Given an integer array nums, handle multiple queries of the following type:
// Calculate the sum of the elements of nums between indices left and right inclusive where left <= right.
// Implement the NumArray class:
// NumArray(int[] nums) Initializes the object with the integer array nums.
// int sumRange(int left, int right) Returns the sum of the elements of nums between indices left and right inclusive (i.e. nums[left] + nums[left + 1] + ... + nums[right]).
@Oyedee
Oyedee / main.dart
Last active October 25, 2023 12:53
Contains Duplicate - LeetCode 1
// Question 1:
// Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
// Example 1:
// Input: nums = [1,2,3,1]
// Output: true
// Example 2:
// Input: nums = [1,2,3,4]
@Oyedee
Oyedee / main.dart
Last active October 24, 2023 12:12
Best Time to Buy and Sell Stock - LeetCode 6
//Problem 6
/*
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Example 1:
@Oyedee
Oyedee / main.dart
Last active October 23, 2023 19:05
Longest substring without repeating character - Leetcode
void main() {
final solution = Solution();
String s = "abcabcbb";
final result = solution.lengthOfLongestSubstring(s);
print(result);
}
/*
* Given a string s, find the length of the longest substring without repeating characters.
@Oyedee
Oyedee / main.dart
Last active October 23, 2023 08:33
Climbing Stairs - LeetCode 5
void main() {
final solution = Solution();
final result = solution.climbStairs(5);
print(result);
}
/*
*
You are climbing a staircase. It takes n steps to reach the top.
@Oyedee
Oyedee / main.dart
Last active October 22, 2023 21:42
Single Number - Leetcode 4
void main() {
final solution = Solution();
List<int> nums = [4, 1, 2, 1, 2];
final result = solution.singleNumber(nums);
print(result);
}
/*
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.
@Oyedee
Oyedee / main.dart
Last active October 22, 2023 13:49
Find All Numbers Disappeared in an Array - Leetcode
void main() {
final solution = Solution();
List<int> nums = [1,1];
final result = solution.findDisappearedNumbers(nums);
print(result);
}
//Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.
@Oyedee
Oyedee / main.dart
Last active October 25, 2023 08:15
Missing Number - LeetCode 2
/*
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
Example 1:
Input: nums = [3,0,1]
Output: 2
Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.
Example 2: