Skip to content

Commit 8d1036c

Browse files
committed
largest subarray of 0s and 1s
1 parent b80697e commit 8d1036c

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

C-practice/Complex Declarations/complex2.c

+12-8
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ typedef int i;
77

88
int main()
99
{
10+
1011
v fun(i,i);
1112

1213
fun(4,3);
1314

1415
return 0;
15-
}
16-
1716

18-
v fun(i a,i b)
19-
{
20-
i s = 3; //here i is the type int
21-
float i;//i is a variable here
22-
printf("%d\n",sizeof(i)); //prints size of a float i
2317

24-
printf("%d",a*b*s);
2518
}
19+
20+
21+
//v fun(i a,i b)
22+
//{
23+
//
24+
// i s = 3; //here i is the type int
25+
// float i;//i is a variable here
26+
// printf("%d\n",sizeof(i)); //prints size of a float i
27+
//
28+
// printf("%d",a*b*s);
29+
//}

Dynamic Programming/LongestPalindromicSubstring.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include<iostream>
22
#include<string.h>
3-
3+
#include<cstdlib>
44

55
using namespace std;
66

@@ -109,10 +109,12 @@ string PrintLongestPalindromicSubstring(string a)
109109

110110
int main()
111111
{
112-
string s = "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth";
113-
cout<<PrintLongestPalindromicSubstring(s);
114-
cout<<endl;
115-
cout<<LPS_DP(s);
112+
// string s = "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth";
113+
// cout<<PrintLongestPalindromicSubstring(s);
114+
// cout<<endl;
115+
// cout<<LPS_DP(s);
116+
117+
116118

117119

118120
return 0;

Dynamic Programming/PrintingTheLCS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void PrintLCS(string &a,string &b,int m,int n)
3333
//getting the length of LCS
3434
//making the array to store the common letters
3535
string LCS(LCSlen+1,'\0');
36-
36+
NULL
3737

3838
int i = m , j = n;
3939

PreProcessors in CPP/ConditionCompilationMacros.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ using namespace std;
44
//CONDITIONAL COMPILATION MACROS
55

66
#define WIN 1
7-
#define LIN 2
7+
#define LIN 1
88
#define MAC 3
99

1010

1111
#define OS MAC
1212
int main()
1313
{
1414

15+
1516
#if OS == WIN
1617
cout<<"Windows OS macro"<<endl;
1718

@@ -21,8 +22,8 @@ int main()
2122
#else
2223
cout<<"MAC OS macro"<<endl;
2324

24-
25-
#endif
25+
#endif
26+
2627

2728
return 0;
2829
}

0 commit comments

Comments
 (0)