Skip to content

Commit 68bc5eb

Browse files
committed
pallindromic array cpp program
1 parent c038593 commit 68bc5eb

File tree

2,462 files changed

+1969
-414574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,462 files changed

+1969
-414574
lines changed

Advent_of_Code_2015_Python/Day_1/Day_1.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_1/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_2/Day_2.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_2/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_2/input_2.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_3/Day_3.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_3/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_3/input_2.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_3/input_3.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_4/Day_4.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_5/Day_5.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_5/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_6/Day_6.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_6/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_6/input_2.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_6/input_3.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_7/Day_7.py

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_7/input.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_7/input_2.txt

100755100644
File mode changed.

Advent_of_Code_2015_Python/Day_7/input_3.txt

100755100644
File mode changed.

Analog-Clock/index.html

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Analog Clock</title>
8-
<link rel="stylesheet" href="style.css">
9-
<script defer src="script.js"></script>
10-
</head>
11-
<body>
12-
<div class="clock">
13-
<div class="hand hour" data-hour-hand></div>
14-
<div class="hand minute" data-minute-hand></div>
15-
<div class="hand second" data-second-hand></div>
16-
<div class="number number1">1</div>
17-
<div class="number number2">2</div>
18-
<div class="number number3">3</div>
19-
<div class="number number4">4</div>
20-
<div class="number number5">5</div>
21-
<div class="number number6">6</div>
22-
<div class="number number7">7</div>
23-
<div class="number number8">8</div>
24-
<div class="number number9">9</div>
25-
<div class="number number10">10</div>
26-
<div class="number number11">11</div>
27-
<div class="number number12">12</div>
28-
</div>
29-
</body>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Analog Clock</title>
8+
<link rel="stylesheet" href="style.css">
9+
<script defer src="script.js"></script>
10+
</head>
11+
<body>
12+
<div class="clock">
13+
<div class="hand hour" data-hour-hand></div>
14+
<div class="hand minute" data-minute-hand></div>
15+
<div class="hand second" data-second-hand></div>
16+
<div class="number number1">1</div>
17+
<div class="number number2">2</div>
18+
<div class="number number3">3</div>
19+
<div class="number number4">4</div>
20+
<div class="number number5">5</div>
21+
<div class="number number6">6</div>
22+
<div class="number number7">7</div>
23+
<div class="number number8">8</div>
24+
<div class="number number9">9</div>
25+
<div class="number number10">10</div>
26+
<div class="number number11">11</div>
27+
<div class="number number12">12</div>
28+
</div>
29+
</body>
3030
</html>

Analog-Clock/script.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
setInterval(setClock, 1000)
2-
3-
const hourHand = document.querySelector('[data-hour-hand]')
4-
const minuteHand = document.querySelector('[data-minute-hand]')
5-
const secondHand = document.querySelector('[data-second-hand]')
6-
7-
function setClock(){
8-
const currentDate = new Date()
9-
const secondsRatio = currentDate.getSeconds()/60
10-
const minutesRatio = (secondsRatio+currentDate.getMinutes())/60
11-
const hoursRatio = (minutesRatio+currentDate.getHours())/12
12-
setRotation(secondHand,secondsRatio)
13-
setRotation(minuteHand,minutesRatio)
14-
setRotation(hourHand,hoursRatio)
15-
}
16-
17-
function setRotation(element, rotationRatio){
18-
element.style.setProperty('--rotation',rotationRatio*360)
19-
}
20-
1+
setInterval(setClock, 1000)
2+
3+
const hourHand = document.querySelector('[data-hour-hand]')
4+
const minuteHand = document.querySelector('[data-minute-hand]')
5+
const secondHand = document.querySelector('[data-second-hand]')
6+
7+
function setClock(){
8+
const currentDate = new Date()
9+
const secondsRatio = currentDate.getSeconds()/60
10+
const minutesRatio = (secondsRatio+currentDate.getMinutes())/60
11+
const hoursRatio = (minutesRatio+currentDate.getHours())/12
12+
setRotation(secondHand,secondsRatio)
13+
setRotation(minuteHand,minutesRatio)
14+
setRotation(hourHand,hoursRatio)
15+
}
16+
17+
function setRotation(element, rotationRatio){
18+
element.style.setProperty('--rotation',rotationRatio*360)
19+
}
20+
2121
setClock()

Analog-Clock/style.css

+86-86
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
*, *::after, ::before{
2-
box-sizing: border-box;
3-
font-family: Gotham Rounded,sans-serif ;
4-
}
5-
6-
body{
7-
background: linear-gradient(to right, rgb(7, 203, 242), rgb(94, 163, 253), rgb(88, 194, 255));
8-
justify-content: center;
9-
display: flex;
10-
align-items: center;
11-
min-height: 100vh;
12-
overflow: hidden;
13-
}
14-
15-
.clock{
16-
background-color: rgba(255, 255, 255, 8);
17-
width: 500px;
18-
height: 500px;
19-
border-radius: 50%;
20-
border: 2px solid black;
21-
position: relative;
22-
}
23-
24-
.clock .number{
25-
position: absolute;
26-
width: 100%;
27-
height: 100%;
28-
text-align: center;
29-
transform: rotate(var(--rotation));
30-
font-size: 1.5rem;
31-
}
32-
33-
.clock .number1 { --rotation: 30deg}
34-
.clock .number2 { --rotation: 60deg}
35-
.clock .number3 { --rotation: 90deg}
36-
.clock .number4 { --rotation: 120deg}
37-
.clock .number5 { --rotation: 150deg}
38-
.clock .number6 { --rotation: 180deg}
39-
.clock .number7 { --rotation: 210deg}
40-
.clock .number8 { --rotation: 240deg}
41-
.clock .number9 { --rotation: 270deg}
42-
.clock .number10 { --rotation: 300deg}
43-
.clock .number11 { --rotation: 330deg}
44-
45-
.clock .hand{
46-
--rotation:30;
47-
position: absolute;
48-
left: 50%;
49-
bottom: 50%;
50-
transform-origin: bottom;
51-
transform: translateX(-50%) rotate(calc(var(--rotation)*1deg));
52-
border: 1px solid white;
53-
border-top-left-radius: 10px;
54-
border-top-right-radius: 10px;
55-
z-index: 10;
56-
}
57-
58-
.clock::after{
59-
content: "";
60-
position: absolute;
61-
height: 15px;
62-
width: 15px;
63-
z-index: 11;
64-
top: 50%;
65-
left: 50%;
66-
background-color: black;
67-
transform: translate(-50%, -50%);
68-
border-radius: 50%;
69-
}
70-
71-
.clock .hand.second{
72-
width: 3px;
73-
height: 45%;
74-
background-color: rgb(8, 0, 255);
75-
}
76-
77-
.clock .hand.minute{
78-
width: 7px;
79-
height: 40%;
80-
background-color: rgba(0, 0, 0, 0.808);
81-
}
82-
83-
.clock .hand.hour{
84-
width: 10px;
85-
height: 35%;
86-
background-color: black;
1+
*, *::after, ::before{
2+
box-sizing: border-box;
3+
font-family: Gotham Rounded,sans-serif ;
4+
}
5+
6+
body{
7+
background: linear-gradient(to right, rgb(7, 203, 242), rgb(94, 163, 253), rgb(88, 194, 255));
8+
justify-content: center;
9+
display: flex;
10+
align-items: center;
11+
min-height: 100vh;
12+
overflow: hidden;
13+
}
14+
15+
.clock{
16+
background-color: rgba(255, 255, 255, 8);
17+
width: 500px;
18+
height: 500px;
19+
border-radius: 50%;
20+
border: 2px solid black;
21+
position: relative;
22+
}
23+
24+
.clock .number{
25+
position: absolute;
26+
width: 100%;
27+
height: 100%;
28+
text-align: center;
29+
transform: rotate(var(--rotation));
30+
font-size: 1.5rem;
31+
}
32+
33+
.clock .number1 { --rotation: 30deg}
34+
.clock .number2 { --rotation: 60deg}
35+
.clock .number3 { --rotation: 90deg}
36+
.clock .number4 { --rotation: 120deg}
37+
.clock .number5 { --rotation: 150deg}
38+
.clock .number6 { --rotation: 180deg}
39+
.clock .number7 { --rotation: 210deg}
40+
.clock .number8 { --rotation: 240deg}
41+
.clock .number9 { --rotation: 270deg}
42+
.clock .number10 { --rotation: 300deg}
43+
.clock .number11 { --rotation: 330deg}
44+
45+
.clock .hand{
46+
--rotation:30;
47+
position: absolute;
48+
left: 50%;
49+
bottom: 50%;
50+
transform-origin: bottom;
51+
transform: translateX(-50%) rotate(calc(var(--rotation)*1deg));
52+
border: 1px solid white;
53+
border-top-left-radius: 10px;
54+
border-top-right-radius: 10px;
55+
z-index: 10;
56+
}
57+
58+
.clock::after{
59+
content: "";
60+
position: absolute;
61+
height: 15px;
62+
width: 15px;
63+
z-index: 11;
64+
top: 50%;
65+
left: 50%;
66+
background-color: black;
67+
transform: translate(-50%, -50%);
68+
border-radius: 50%;
69+
}
70+
71+
.clock .hand.second{
72+
width: 3px;
73+
height: 45%;
74+
background-color: rgb(8, 0, 255);
75+
}
76+
77+
.clock .hand.minute{
78+
width: 7px;
79+
height: 40%;
80+
background-color: rgba(0, 0, 0, 0.808);
81+
}
82+
83+
.clock .hand.hour{
84+
width: 10px;
85+
height: 35%;
86+
background-color: black;
8787
}

Array/AlternatePnN.cpp

+45-45
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
using namespace std;
2-
#include <iostream>
3-
#include <vector>
4-
5-
void rearrange(int arr[], int n){
6-
vector <int> pos;
7-
vector <int> neg;
8-
for(int i=0;i<n;i++){
9-
if(arr[i]>=0){
10-
pos.push_back(arr[i]);
11-
}
12-
else{
13-
neg.push_back(arr[i]);
14-
}
15-
}
16-
int posindex=0;
17-
int negindex=0;
18-
for(int i=0;i<n;i++){
19-
if(posindex<pos.size() && posindex==negindex){
20-
arr[i]=pos[posindex];
21-
posindex++;
22-
}
23-
else if(negindex<neg.size() && posindex>negindex){
24-
arr[i]=neg[negindex];
25-
negindex++;
26-
}
27-
else if(negindex==neg.size() && posindex<pos.size()){
28-
arr[i]=pos[posindex];
29-
posindex++;
30-
}
31-
else if(posindex==pos.size() && negindex<neg.size()){
32-
arr[i]=neg[negindex];
33-
negindex++;
34-
}
35-
}
36-
}
37-
38-
int main(){
39-
int arr[9] = {9, 4, -2, -1, 5, 0, -5, -3, 2};
40-
rearrange(arr,9);
41-
for (int i = 0; i < 9; i++)
42-
{
43-
cout<<arr[i]<<" ";
44-
}
45-
1+
using namespace std;
2+
#include <iostream>
3+
#include <vector>
4+
5+
void rearrange(int arr[], int n){
6+
vector <int> pos;
7+
vector <int> neg;
8+
for(int i=0;i<n;i++){
9+
if(arr[i]>=0){
10+
pos.push_back(arr[i]);
11+
}
12+
else{
13+
neg.push_back(arr[i]);
14+
}
15+
}
16+
int posindex=0;
17+
int negindex=0;
18+
for(int i=0;i<n;i++){
19+
if(posindex<pos.size() && posindex==negindex){
20+
arr[i]=pos[posindex];
21+
posindex++;
22+
}
23+
else if(negindex<neg.size() && posindex>negindex){
24+
arr[i]=neg[negindex];
25+
negindex++;
26+
}
27+
else if(negindex==neg.size() && posindex<pos.size()){
28+
arr[i]=pos[posindex];
29+
posindex++;
30+
}
31+
else if(posindex==pos.size() && negindex<neg.size()){
32+
arr[i]=neg[negindex];
33+
negindex++;
34+
}
35+
}
36+
}
37+
38+
int main(){
39+
int arr[9] = {9, 4, -2, -1, 5, 0, -5, -3, 2};
40+
rearrange(arr,9);
41+
for (int i = 0; i < 9; i++)
42+
{
43+
cout<<arr[i]<<" ";
44+
}
45+
4646
}

0 commit comments

Comments
 (0)