Skip to content

Instantly share code, notes, and snippets.

View iamdejan's full-sized avatar
🎯
Focusing

Giovanni Dejan iamdejan

🎯
Focusing
  • 11:49 (UTC +07:00)
View GitHub Profile
@iamdejan
iamdejan / ISSUE_TEMPLATE.md
Created March 8, 2020 03:10
Issue Template

[Issue Title Here]

Detailed Description

Context

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@iamdejan
iamdejan / 0001.diff
Last active April 26, 2020 14:35
Rust BDD + Shunting Yard FTW
--- left.rs 2020-04-25 23:42:33.000000000 +0700
+++ right.rs 2020-04-25 23:48:14.000000000 +0700
@@ -0,0 +1,15 @@
+pub fn shunting_yard(_token_list: Vec<String>) -> Result<Vec<String>, String> {
+ return Err("Empty token list".to_owned());
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
@iamdejan
iamdejan / First Bad Version.md
Last active May 6, 2020 09:57
First Bad Version - Leetcode May 30-Day Challenge

First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.

Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad.

You are given an API bool isBadVersion(version) which will return whether version is bad. Implement a function to find the first bad version. You should minimize the number of calls to the API.

Example:

@iamdejan
iamdejan / Majority Element.md
Last active May 6, 2020 09:57
Majority Element - Leetcode May 30-Day Challenge

Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than [n/2] times.

You may assume that the array is non-empty and the majority element always exist in the array.

Example 1:

Input: [3,2,3]
Output: 3
@iamdejan
iamdejan / Number Complement.md
Last active May 6, 2020 09:56
Number Complement - Leetcode May 30-Day Challenge

Number Complement

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.

Example 1:

Input: 5
Output: 2
Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2.
@iamdejan
iamdejan / Jewels and Stones.md
Last active May 16, 2020 08:34
Jewels and Stones - Leetcode April 30-Day Challenge

Jewels and Stones

You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.

The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A".

Example 1:

Input: J = "aA", S = "aAAbbbb"
Output: 3