Skip to content

Instantly share code, notes, and snippets.

View kingsamadesu's full-sized avatar

Ismail Oukha kingsamadesu

View GitHub Profile
@kingsamadesu
kingsamadesu / RealTimeDataUpdateForYoutubeVideo.js
Last active January 22, 2021 21:55
JavaScript script that provide real time animated update to like-count and views-count in a YouTube video page Using YouTube API v3.
//JavaScript script that provide real time animated update to like-count and views-count in a YouTube video page Using YouTube API v3.
//you can run that code by copying it to the js console of your browser
//and run the funcion Start()
//You can stop this by runing the fuction killTimer() or just refresh the page.
//this script use youtube API,for this reason I have created API key for this scrip,keep in minde the API key can stop working,so it's preferable to have your own API key.
//I was too lazy so I didn't add the real time update to comments number and subscibes may you can fork this guest and do it, so easy!!!!.
//
const API_Key = "AIzaSyAPXyji7zyhfUM5932TTdkD7BXQT5RMCyY";//here is the API key you can change it here
@kingsamadesu
kingsamadesu / SotedList.java
Created December 8, 2020 15:44
SortedList Implementation using ArrayList in java,
//there is no List collection in java that keeps its elements sorted, and provides imidiat sorting while inserting element
//So this is a simple essay to adjust the add() method to keep the collection sorted after add an element.
//this simple essay keeps all ArrayList methods usable,
//if you want to sort a collection what ever is it you can just pass it as a parameter to the constructor
//package Mypakage;
import java.util.ArrayList;
import java.util.Collection;
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:33
283. Move Zeroes -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
*/
class Solution {
public void moveZeroes(int[] nums) {
int j = 0;
for (int i = 0 ; i < nums.length-1 ; i++){
if(nums[i]==0){
if(nums[i+1]==0){
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:30
1446. Consecutive Characters -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
Your memory usage beats 30.96 % of java submissions.
*/
class Solution {
public int maxPower(String s) {
int n = s.length();
int max = 0;
int testmax = 0;
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:28
1217. Minimum Cost to Move Chips to The Same Position -with java- (leetcode.com)
/*
Your memory usage beats 74.60 % of java submissions.
*/
class Solution {
public int min(int a, int b){
if (a<b){
return a;
}
return b;
}
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:27
977. Squares of a Sorted Array -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
Your memory usage beats 66.62 % of java submissions.
*/
class Solution {
public int abs(int a){
if(a >= 0){return a;}
return -a;
}
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:25
1323. Maximum 69 Number -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
Your memory usage beats 68.73 % of java submissions.
*/
class Solution {
public int maximum69Number (int num){
int n = num;
int c = 0;
int d = 1;
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:24
1295. Find Numbers with Even Number of Digits -with java- (leetcode.com)
/*
Your runtime beats 94.08 % of java submissions.
Your memory usage beats 67.73 % of java submissions.
*/
class Solution {
public boolean test(int n){
if(n==0){
return true;
}
return false==test(n/10);
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:20
1290. Convert Binary Number in a Linked List to Integer -with java- (leetcode.com)
/*
Your runtime beats 100.00 % of java submissions.
Your memory usage beats 83.62 % of java submissions.
*/
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
@kingsamadesu
kingsamadesu / Solution.java
Created December 3, 2020 21:18
1528. Shuffle String -with java- (leetcode.com)
/*
Your memory usage beats 94.03 % of java submissions.
Your runtime beats 99.93 % of java submissions.
*/
class Solution {
public String restoreString(String s, int[] indices) {
int count = 0;
char[] array = new char[indices.length];
for(int i = 0 ; i < indices.length ; i++){