Skip to content

Instantly share code, notes, and snippets.

View Pasi-D's full-sized avatar
🤖
Dreaming Big 🌠

Pasindu Dilshan Pasi-D

🤖
Dreaming Big 🌠
View GitHub Profile
class Node(object):
def __init__(self, data):
self.data = data
self.leftchild = None
self.rightchild = None
def insert(self,data):
#all the heavy lifting stuff is done in the node class
if(self.data == data):
return False #we dont want any duplicates
for _ in range(int(input())):
n = int(input())
mat = [list(map(int, input().split())) for _ in range(2*n)]
print (sum([max([mat[i][j],
mat[i][2*n-1-j],
mat[2*n-1-i][j],
mat[2*n-1-i][2*n-1-j]])
for i in range(n)
for j in range(n)]))
class Vertex:
def __init__(self, value):
self.value = value
self.adjacents = []
self.state = 0
class Graph:
def __init__(self):
self.vertices = []
# self.edges = []
/* Main objective is to get the man to the relevent stair (from 1-5) based on user input
Just compile this file and run java newStairs
*/
import java.util.Scanner;
class Stars{
static void makeStars(String init){
for (int j = 0;j <= 4 ;j++ ) {
System.out.print(init);
if(j == 4){
for (int i = 0;i <= 3;i++ ) {
/*This simple java file allows the user to decrypt any message that was encrypted using reverse alphabet methodology */
import java.util.Scanner;
class Decrypt{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the encrypted String : ");
String encrString = scan.nextLine();
#include <stdio.h>
#include <string.h>
void main(){
int n, m, pos, i;
char text[256], pattern[256];
printf("Enter the text first\n");
gets(text);
n = strlen(text);
printf("Enter the pattern\n");
@Pasi-D
Pasi-D / UploadFileComponent.tsx
Created March 26, 2020 12:52 — forked from vdelacou/UploadFileComponent.tsx
React / Typescript / Material UI / Upload file / Custom Button / Async /
// import .....
const inputUploadFile: CSSProperties = {
display: 'none',
};
const buttonUploadFile: CSSProperties = {
margin: 8,
};
@Pasi-D
Pasi-D / theme.d.ts
Created April 27, 2021 17:40
React Native Element's Theme interface extended for customizability
import { FullTheme, ButtonProps } from "react-native-elements";
import { Colors } from "react-native-elements/dist/config/colors";
type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> };
interface IExtendedThemeButtonProps extends Partial<ButtonProps> {
titleAppearances?: {
titleColors?: {
primary: string;
};
@Pasi-D
Pasi-D / index.ts
Last active May 2, 2021 14:13
Extended Theme file for react native
import { useContext } from "react";
import { FullTheme, ButtonProps, ThemeContext } from "react-native-elements";
import { ThemeProps } from "react-native-elements/dist/config/ThemeProvider";
import { Colors } from "react-native-elements/dist/config/colors";
import { RecursivePartial } from "utils/core";
interface IExtendedThemeButtonProps extends Partial<ButtonProps> {
titleAppearances?: {
titleColors?: {
primary: string;
};
@Pasi-D
Pasi-D / App.tsx
Created April 27, 2021 17:54
Medium Demo - Simple Root File of a react native styled project
import "react-native-gesture-handler";
import React, { FC } from "react";
import { ReloadInstructions } from "react-native/Libraries/NewAppScreen";
import { ThemeProvider } from "react-native-elements";
import theme from "themes";
const App: FC = () => {
return (
<ThemeProvider theme={theme}>