Skip to content

Instantly share code, notes, and snippets.

View Neo-sunny's full-sized avatar
🎯
Focusing

Neo Neo-sunny

🎯
Focusing
View GitHub Profile
@Neo-sunny
Neo-sunny / PY0101EN-2-1-Tuples.ipynb
Created March 12, 2019 05:11
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Neo-sunny
Neo-sunny / PY0101EN-3-4-Classes.ipynb
Created March 12, 2019 09:34
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Neo-sunny
Neo-sunny / PY0101EN-4-1-ReadFile.ipynb
Created March 17, 2019 09:22
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// C/C++ program to solve greedy mobile Manuf.
#include <bits/stdc++.h>
using namespace std;
// Structure for an Mobile which stores Parts manf. and Assembling
struct Mobile
{
int pm, assm;
public static int getTotalX(List<Integer> a, List<Integer> b) {
Collections.sort(a); Collections.sort(b);
int lcmOfa = lcmOfNumbers(a);
int gcdofb = b.get(0);
for(int i=1; i<b.size(); i++){
gcdofb = gcd(gcdofb,b.get(i));
}
int start = lcmOfa;
int end = gcdofb;
int count=0;
class Solution {
public int numIslands(char[][] grid) {
int vis[][] = new int[301][301];
for(int[] m:vis) Arrays.fill(m,0);
int[][] river = new int[grid.length][grid[0].length];
for(int i=0; i<grid.length; i++){
for(int j=0; j<grid[i].length; j++){
int val = grid[i][j]-'0';
river[i][j]=val;
}
import java.util.*;
public class Solution {
public static int tripletSum(int[] A, int num) {
Arrays.sort(A);// nlog(n)
int len = A.length;
int count = 0;
for(int i=0; i<len; i++) {
int pairsum=num -A[i];
count+=getPairsCount(A,i+1, len-1,pairsum);