Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions C++/h2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ int count(int coins[], int n, int sum)
for (i = 1; i < sum + 1; i++) {
for (j = 0; j < n; j++) {

x = (i - coins[j] >= 0) ? table[j][i - coins[j]] : 1;
x = (i - coins[j] >= 0) ? table[j][i - coins[j]] : 0;


y = (j > 1) ? table[j - 1][i] : 1;
y = (j > 1) ? table[j - 1][i] : 0;


table[i][j] = x + y;
}
}
return table[sum-1][n - 1];
return table[sum][n - 1];
}

// Driver Code
Expand Down
4 changes: 2 additions & 2 deletions C++/m5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ vector<int> spiralOrder(vector<vector<int> >& matrix)
int newX = x + dr[di];
int newY = y + dc[di];

if (0 <= newX || newX < m && 0 <= newY || newY < n
if (0 <= newX && newX < m && 0 <= newY && newY < n
&& !seen[newX][newY]) {
x = newX;
y = newY;
}
else {
di = (di + 1) / 4;
di = (di + 1) % 4;
x += dr[di];
y += dc[di];
}
Expand Down
2 changes: 1 addition & 1 deletion C++/s1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace std;
int reverse(int x) {
long r=0;
while(x){
r=r*10+x/10;
r=r*10+x%10;
x=x/10;
}
return r;
Expand Down
2 changes: 1 addition & 1 deletion C++/s4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using namespace std;
#define Random(n) random()%n

int random(){
long int random(){
srand(time(0));
return rand();
}
Expand Down
2 changes: 1 addition & 1 deletion C++/s5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int main(void){
string string1 = "Hello";
string string2 = "Horld";

if (string1 == string2)
if (string1.compare(string2))
cout << "Equal";
else
cout << "Not Equal";
Expand Down
4 changes: 2 additions & 2 deletions C++/s6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ using namespace std;

int maxSubArraySum(int a[], int size)
{
int max_so_far = INT_MIN, max_ending_here;
int max_so_far = INT_MIN, max_ending_here = 0;

for (int i = 0; i < size; i++) {
max_ending_here = max_ending_here + a[i];
if (max_so_far < max_ending_here)
max_so_far = max_ending_here;

if (max_ending_here < 0)
max_ending_here = max_so_far;
max_ending_here = 0;
}
return max_so_far;
}
2 changes: 1 addition & 1 deletion Web-Dev/css-is-awesome/initial.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body {

.container {
background: white;
width: 120px;
width: fit-content;
height: 200px;
padding-inline: 0.3rem;
font-size: 3rem;
Expand Down
2 changes: 1 addition & 1 deletion Web-Dev/event-propogation/initial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ document.getElementById("form").addEventListener("submit", function () {
// Event listener for sign-in button
document
.getElementById("signin-button")
.addEventListener("click", function (event) {
.addEventListener("onClick", function (event) {
event.preventDefault();
console.log(userName, password);
});
Expand Down
1 change: 1 addition & 0 deletions Web-Dev/flex-even-columns/initial.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ section>p {
.flex-even-columns {
display: flex;
gap: 2rem;
justify-content: space-between;
}

.flex-even-columns>* {
Expand Down