This file contains hidden or 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
| import math | |
| n = int(input()) | |
| edges = int(input()) | |
| space = [-1 for i in range(0,n+1)] | |
| count = 0 | |
| for i in range(0,edges): | |
| a,b = map(int,input().split()) | |
| if a > b: | |
| temp = a |
This file contains hidden or 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
| import java.util.*; | |
| public class detectGraphCycles { | |
| public static void main(String[] args) { | |
| int n = 4; | |
| int src = 0; | |
| int graph[][] = { | |
| {0,1,0,0}, | |
| {0,0,1,0}, | |
| {0,1,0,0}, | |
| {1,0,1,0} |
This file contains hidden or 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
| final String phpEndPoint = 'http://192.168.43.171/phpAPI/image.php'; | |
| final String nodeEndPoint = 'http://192.168.43.171:3000/image';File file; | |
| void _choose() async { | |
| file = await ImagePicker.pickImage(source: ImageSource.camera); | |
| // file = await ImagePicker.pickImage(source: ImageSource.gallery); | |
| } | |
| void _upload() { | |
| if (file == null) return; |
This file contains hidden or 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
| def commonWhites(N,M,arr1,arr2,arr3): | |
| flatten1 = set(sum(arr1,[])) | |
| flatten2 = set(sum(arr2,[])) | |
| flatten3 = set(sum(arr3,[])) | |
| ans = flatten1.intersection(flatten2).intersection(flatten3) | |
| if(len(ans) == 0): | |
| return -1 | |
| else: | |
| return len(ans) |
This file contains hidden or 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
| def strangeStrings(string,n): | |
| string1 = string[0:n] | |
| string2 = string[n:] | |
| arr1 = [False for i in range(0,n)] | |
| arr2 = [False for i in range(n,len(string))] | |
| strAns = "" | |
| while ((string1 != "") and (string2 != "")): | |
| min1 = min(string1) | |
| min2 = min(string2) |
This file contains hidden or 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
| import java.util.*; | |
| public class BreadthFirstSearch{ | |
| /** | |
| * What exactly is breadth first search, we find a start node and we go through all the connected nodes | |
| * and all then we put in a queue and go ahead, on the way we keep marking the nodes as visited. | |
| * | |
| * 1. The complexity if we use an Adjacency Matrix is O(Vertices^2) | |
| * 2. The complexity if we use an Adjacency List is O(V+E) | |
| * | |
| * Reason: In case of an Adjacency Matrix, we will be going through all the possible cells in a matrix |
This file contains hidden or 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
| mouse_selected = -1 | |
| keyboard_selected = -1 | |
| def printClosest(m,n,a1,a2,money): | |
| max_amt = 0 | |
| for i in range(0,len(a1)): | |
| sum = 0 | |
| for j in range(0,len(a2)): | |
| sum = a1[i] + a2[j] |
This file contains hidden or 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
| def reverse(number): | |
| reverse = 0 | |
| while(number > 0): | |
| mod_num = number % 10 | |
| reverse = reverse * 10 + mod_num | |
| number = number // 10 | |
| return reverse | |
| def shuffle(m1,m2): | |
| rev_num1 = reverse(m1) |
This file contains hidden or 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
| public static List<Integer> sortIntersect(List<Integer> volcanic,List<Integer> nonVolcanic){ | |
| List<Integer> ans = new ArrayList<Integer>(); | |
| int i = 0, j = 0; | |
| Collections.sort(volcanic); | |
| Collections.sort(nonVolcanic); | |
| while (i < volcanic.size() && j < nonVolcanic.size()) | |
| { | |
| if (volcanic.get(i) > nonVolcanic.get(j)) | |
| { |
This file contains hidden or 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
| import java.util.*; | |
| public class Skiils{ | |
| public static void main(String[] args) { | |
| HashMap<Character,Integer> hMap = new HashMap<Character,Integer>(); | |
| Scanner sc = new Scanner(System.in); | |
| String str = sc.nextLine(); | |
| for(int i=0;i<str.length();i++){ | |
| if(hMap.containsKey(str.charAt(i))){ | |
| hMap.put(str.charAt(i),hMap.get(str.charAt(i))+1); | |
| } |