This file contains 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
#! /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) |
This file contains 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 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) |
This file contains 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 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++){ |