Skip to content

Instantly share code, notes, and snippets.

View lingpri's full-sized avatar
🎯
Focusing

Priya lingpri

🎯
Focusing
  • Sugar Land,TX
View GitHub Profile
#!/bin/python3
'''
Given the element [86, 74, 8, 74, 92, 44, 24] for the first pass, we find the element to the left of 86, which is empty, so we add 0 (-1 + 1 = 0) as the index to the left stack.
Given the element [86, 74, 8, 74, 92, 44, 24] for the second pass, we find the closest element to the left of 74, which is greater than 74, so we push index 1 with a value of 86 (0 + 1 = 1) to the left stack.
Given the element [86, 74, 8, 74, 92, 44, 24] for the third pass, we find the closest element to the left of 8, which is greater than 8, so we push index 2 (1 + 1 = 2) with value 74 as the index to the left stack.
Given the element [86, 74, 8, 74, 92, 44, 24] for the fourth pass, we find the closest element to the left of 74, which is greater than 74, so we push the index 0 with a value of 86 (0 + 1 =1) to the left stack.
@lingpri
lingpri / Functional.java
Created June 6, 2023 21:52
Learning Generics
import java.math.*;
import java.util.concurrent.atomic.*;
import java.util.*;
interface Combiner<T> {T combine(T x, T y); }
interface UnaryFunction<R,T> {R function(T x);}
interface Collector<T> extends UnaryFunction<T,T> {
T result(); //extract result of collecting parameter
}
def convert_pdf_to_text(filename):
count = 0
text = ""
pdfFileObj = open(filename,'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
num_pages = pdfReader.numPages
while count < num_pages:
pageObj = pdfReader.getPage(count)
count +=1
text += pageObj.extractText()
sudo apt install python3.6
sudo apt-get install ipython3
whereis python
which python
python3
ipython3
import {Component, h} from 'preact'; // eslint-disable-line no-unused-vars
import React from 'react';
import Select from 'react-select';
import { CompactPicker } from 'react-color';
import {AlphaPicker} from 'react-color';
import reactCSS from 'reactcss';
import Style from './Style';
class MyTestColorPicker extends React.Component {