This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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++){ |
NewerOlder