Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7ab1c9a
Frugal numbers
SharmaRithik Sep 30, 2020
d0261f3
Merge pull request #1 from SharmaRithik/PRACTISE-QUESTIONS
infinixaco Sep 30, 2020
79c67df
Binary search
SharmaRithik Oct 1, 2020
e88b06b
Merge pull request #2 from infinixaco/DATA-STRUCTURES
SharmaRithik Oct 1, 2020
110a8a4
Merge pull request #4 from infinixaco/ALGORITHMS
infinixaco Oct 9, 2020
fa9e11e
Minimum time required to produce m items
SharmaRithik Oct 9, 2020
4faa93e
fixures
SharmaRithik Oct 9, 2020
3ce88d0
Minimum time required to produce m items
SharmaRithik Oct 9, 2020
bcd6512
Merge pull request #5 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 9, 2020
11dd3fa
Floor in a Sorted Array
SharmaRithik Oct 9, 2020
73072f8
Merge pull request #6 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 9, 2020
cb01813
Add files via upload
neshadsfz Oct 10, 2020
2a367bf
Array
neshadsfz Oct 10, 2020
db28929
calculate the interest
neshadsfz Oct 10, 2020
9d63277
Circle
neshadsfz Oct 10, 2020
7734fbd
Cpy to dma
neshadsfz Oct 10, 2020
c09a877
Reverse array
wneshad Oct 10, 2020
e864ce3
Merge pull request #7 from neshadsfz/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
adfebb5
Merge pull request #8 from neshadsfz/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
ccc9371
Merge pull request #12 from wneshad/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
e46b4f1
Add files via upload
mehuldev Oct 15, 2020
91faa38
covering_segments.py
infinixaco Oct 15, 2020
25dd7af
Create Circular_Queue.cpp
pkkh2000 Oct 18, 2020
bc4023d
Merge pull request #19 from pkkh2000/master
infinixaco Oct 18, 2020
a8e4a2d
Create Binary_Search.cpp
pkkh2000 Oct 18, 2020
846478a
Merge pull request #22 from pkkh2000/patch-2
infinixaco Oct 18, 2020
bc32acc
Merge pull request #24 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 18, 2020
19f1994
Create Naive_Pattern_Searching.cpp
j2704 Oct 29, 2020
3a87113
Merge pull request #26 from j2704/patch-1
infinixaco Oct 29, 2020
6519793
Create normal.cpp
j2704 Oct 29, 2020
1938664
Merge pull request #28 from j2704/patch-3
infinixaco Oct 29, 2020
64984f4
Create digit_removal.cpp
vinayaksaxena1507 Oct 10, 2021
b58cb5c
Merge pull request #33 from vinayaksaxena1507/PRACTISE-QUESTIONS
infinixaco Oct 11, 2021
5e79ac4
Create int_representation_llvmir
SharmaRithik Oct 11, 2021
dd8bbcd
Merge pull request #35 from infinixaco/llvm_ir
infinixaco Oct 11, 2021
1f1571f
Create C++_add_in_llvmir
SharmaRithik Oct 11, 2021
03f8c91
Merge pull request #36 from infinixaco/llvm_ir
infinixaco Oct 11, 2021
9f4e74f
Create while_llvmir
SharmaRithik Oct 11, 2021
bdb57f3
Create Codeforces 1580A Portal
infinixaco Oct 11, 2021
b3c6c38
Merge pull request #44 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 11, 2021
32706fd
Create Adding two numbers in Ruby
wneshad Oct 23, 2021
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
16 changes: 16 additions & 0 deletions Adding two numbers in Ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
=begin
Ruby program to add two numbers.
=end

# input the numbers and converting
# them into integer
puts "Enter first value: "
num1=gets.chomp.to_i
puts "Enter second value: "
num2=gets.chomp.to_i

# finding sum
sum=num1+num2

# printing the result
puts "The sum is #{sum}"
25 changes: 25 additions & 0 deletions Array structure.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// main.c
// Array structure
//
// Created by APPLE on 11/13/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>

struct friend
{
int phoneno;
char name[10];
int hno;

}s[5];
int main()
{
int i;
for(i=0;i<5;i++)
scanf("%s%d%d",s[i].name,&s[i].phoneno,&s[i].hno);
for(i=0;i<5;i++)
printf("%s%d%d\n",s[i].name,&s[i].phoneno,&s[i].hno);
}
88 changes: 88 additions & 0 deletions Binary_Search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// C++ program to implement
// the above approach

#include <bits/stdc++.h>
using namespace std;

// Stores the frequency of
// each type of chocolate
map<int, int> mp;

int N, P;

// Function to check if chocolates
// can be eaten for 'mid' no. of days
bool helper(int mid)
{

int cnt = 0;
for (auto i : mp) {
int temp = i.second;

while (temp >= mid) {
temp -= mid;
cnt++;
}
}

// If cnt exceeds N,
// return true
return cnt >= N;
}

// Function to find the maximum
// number of days for which
// chocolates can be eaten
int findMaximumDays(int arr[])
{

// Store the frequency
// of each type of chocolate
for (int i = 0; i < P; i++) {
mp[arr[i]]++;
}

// Initialize start and end
// with 0 and P respectively
int start = 0, end = P, ans = 0;
while (start <= end) {

// Calculate mid
int mid = start
+ ((end - start) / 2);

// Check if chocolates can be
// distributed for mid days
if (mid != 0 and helper(mid)) {

ans = mid;

// Check if chocolates can
// be distributed for more
// than mid consecutive days
start = mid + 1;
}
else if (mid == 0) {
start = mid + 1;
}
else {
end = mid - 1;
}
}

return ans;
}

// Driver code
int main()
{

N = 3, P = 10;
int arr[] = { 1, 2, 2, 1, 1,
3, 3, 3, 2, 4 };

// Function call
cout << findMaximumDays(arr);

return 0;
}
21 changes: 21 additions & 0 deletions C++_add_in_llvmir
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

define dso_local i32 @main() #0 !dbg !7 {
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
call void @llvm.dbg.declare(metadata i32* %1, metadata !12, metadata !DIExpression()), !dbg !13
store i32 5, i32* %1, align 4, !dbg !13
call void @llvm.dbg.declare(metadata i32* %2, metadata !14, metadata !DIExpression()), !dbg !15
store i32 4, i32* %2, align 4, !dbg !15
call void @llvm.dbg.declare(metadata i32* %3, metadata !16, metadata !DIExpression()), !dbg !17
%4 = load i32, i32* %1, align 4, !dbg !18
%5 = load i32, i32* %2, align 4, !dbg !19
%6 = add nsw i32 %4, %5, !dbg !20
store i32 %6, i32* %3, align 4, !dbg !17
ret i32 0, !dbg !21
}

declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

attributes #0 = { noinline norecurse nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }
22 changes: 22 additions & 0 deletions Circle.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// main.c
// CIRCLE
//
// Created by APPLE on 23/08/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>

int main() {
float radius, area;

printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);

area = 3.14 * radius * radius;
printf("\nArea of Circle : %f", area);

return (0);
}

134 changes: 134 additions & 0 deletions Circular_Queue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// C or C++ program for insertion and
// deletion in Circular Queue
#include<bits/stdc++.h>
using namespace std;

struct Queue
{
// Initialize front and rear
int rear, front;

// Circular Queue
int size;
int *arr;

Queue(int s)
{
front = rear = -1;
size = s;
arr = new int[s];
}

void enQueue(int value);
int deQueue();
void displayQueue();
};


/* Function to create Circular queue */
void Queue::enQueue(int value)
{
if ((front == 0 && rear == size-1) ||
(rear == (front-1)%(size-1)))
{
printf("\nQueue is Full");
return;
}

else if (front == -1) /* Insert First Element */
{
front = rear = 0;
arr[rear] = value;
}

else if (rear == size-1 && front != 0)
{
rear = 0;
arr[rear] = value;
}

else
{
rear++;
arr[rear] = value;
}
}

// Function to delete element from Circular Queue
int Queue::deQueue()
{
if (front == -1)
{
printf("\nQueue is Empty");
return INT_MIN;
}

int data = arr[front];
arr[front] = -1;
if (front == rear)
{
front = -1;
rear = -1;
}
else if (front == size-1)
front = 0;
else
front++;

return data;
}

// Function displaying the elements
// of Circular Queue
void Queue::displayQueue()
{
if (front == -1)
{
printf("\nQueue is Empty");
return;
}
printf("\nElements in Circular Queue are: ");
if (rear >= front)
{
for (int i = front; i <= rear; i++)
printf("%d ",arr[i]);
}
else
{
for (int i = front; i < size; i++)
printf("%d ", arr[i]);

for (int i = 0; i <= rear; i++)
printf("%d ", arr[i]);
}
}

/* Driver of the program */
int main()
{
Queue q(5);

// Inserting elements in Circular Queue
q.enQueue(14);
q.enQueue(22);
q.enQueue(13);
q.enQueue(-6);

// Display elements present in Circular Queue
q.displayQueue();

// Deleting elements from Circular Queue
printf("\nDeleted value = %d", q.deQueue());
printf("\nDeleted value = %d", q.deQueue());

q.displayQueue();

q.enQueue(9);
q.enQueue(20);
q.enQueue(5);

q.displayQueue();

q.enQueue(20);
return 0;
}
26 changes: 26 additions & 0 deletions Codeforces 1580A Portal
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;

const int N=400+5;
char mp[N][N];
int n,m,ans,f[N],s[N][N];
void solve(){
cin>>n>>m,ans=1e9;
for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)
cin>>mp[i][j],s[i][j]=s[i-1][j]+mp[i][j]-'0';
for(int i=1;i<=n;i++)
for(int j=i+4;j<=n;j++){
int pre=1e9,cur=0;
for(int k=1;k<=m;k++){
if(k>3)pre=min(pre,f[k-3]);
int nd=s[j-1][k]-s[i][k];
ans=min(ans,pre+cur+(f[k]=j-i-1-nd));
cur+=nd+(mp[i][k]=='0')+(mp[j][k]=='0'),f[k]-=cur;
}
} cout<<ans<<endl;
}
int main(){
int T; cin>>T;
while(T--)solve();
return 0;
}
28 changes: 28 additions & 0 deletions Cpy to dma.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// main.c
// CPY DMA
//
// Created by APPLE on 11/1/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
char s1[20];
char s2[20];
int result;
printf("\nEnter the string");
gets(s1);
strcpy(s2,s1);
strrev(s2);
result=strcmp(s1,s2);
if(result==0)
printf("\nIt is a palindrome string");
else
printf("\n It is not a palindrome string");

}
Loading