Skip to content

Instantly share code, notes, and snippets.

View bourneagain's full-sized avatar

Shyam Rajendran bourneagain

View GitHub Profile
#! /usr/bin/python3
# Socket server in python using select function
import socket, select
if __name__ == "__main__":
CONNECTION_LIST = [] # list of socket clients
RECV_BUFFER = 4096 # Advisable to keep it as an exponent of 2
PORT = 5000
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def findMax(A):
maxW=0
startValue=A[0]
count=0
for count,i in enumerate(A):
if count==0 or i==A[-1]:
startValue=i
continue
if i<startValue:
maxW=maxW+(startValue-i)
public void cal(char[] str){
System.out.println(str.length);
int dp[][] = new int[str.length+1][str.length+1];
for (int i=0; i<str.length; i++){
dp[i][i] = 1;
}
int lpsLong = Integer.MIN_VALUE;
for (int c=2; c<=str.length; c++){
for (int i=0; i<=str.length-c; i++){