Skip to content

Instantly share code, notes, and snippets.

View Ram-1234's full-sized avatar
🔍
looking for job change

Ramnayan yadav Ram-1234

🔍
looking for job change
View GitHub Profile
specification-
Given an N*N matrix. Print the elements of the matrix in anticlockwise order (see the sample for better understanding)
Sample Input
4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
specification-
Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
Example-
Sample Input:-
1 - > 2 - > 3 - > 4
@Ram-1234
Ram-1234 / find all factors of a integer number InterviewBit problem
Created January 10, 2021 16:07
ALL FACTORS OF NATURAL NUMBER INTERVIEWBIT
#####******SOLUTION IN JAVA*******########
specification:-
Given a number N, find all factors of N.
Example:-
N = 6
factors = {1, 2, 3, 6}
public class Solution {
@Ram-1234
Ram-1234 / Decimal to Binary code in java
Created January 10, 2021 17:39
DECIMAL TO BINARY PROBLEM SOLUTION IN JAVA
###***********java code*************######
specification:-
Given a number N >= 0, find its representation in binary.
Example:
if N = 6,
binary form = 110
specification:-
Following code tries to figure out if a number is prime
public class Solution {
public int isPrime(int A) {
if(A==1){
return 0;
}
else{
int upperLimit = (int)(Math.sqrt(A));
@Ram-1234
Ram-1234 / InterviewBit prime factor problem solution in java code
Created January 10, 2021 19:26
All prime numbers in between of a given integer
specification:-
Given a number N, find all prime numbers upto N ( N included ).
Example:
if N = 7,
all primes till 7 = {2, 3, 5, 7}
Make sure the returned array is sorted.
@Ram-1234
Ram-1234 / minimum path sum of grid leetcode problem
Last active January 14, 2021 19:25
MINIMUM PATH SUM LEETCODE
specification:-Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at any point in time.
grid = 1 3 1
2 5 1
4 2 1
Input: grid = [[1,3,1],[1,5,1],[4,2,1]]
Output: 7
Explanation: Because the path 1 → 3 → 1 → 1 → 1 minimizes the sum.
@Ram-1234
Ram-1234 / maximum element stack problem solution in java
Created January 18, 2021 04:58
HACKERRANK MAXIMUM ELEMENT STACK PROBLEM
specification:- You have an empty sequence, and you will be given N queries. Each query is one of these three types:
1 x -Push the element x into the stack.
2 -Delete the element present at the top of the stack.
3 -Print the maximum element in the stack.
sample input:
10
1 97
2
1 20
@Ram-1234
Ram-1234 / max subarray solution in java
Created February 3, 2021 18:54
Max Non Negative SubArray InterViewBit problem and solution
Problem Description:-
Given an array of integers, A of length N, find out the maximum sum sub-array of non negative numbers from A.
The sub-array should be contiguous i.e., a sub-array created by choosing the second and fourth element and
skipping the third element is invalid.
Maximum sub-array is defined in terms of the sum of the elements in the sub-array.
NOTE:-
1-If there is a tie, then compare with segment's length and return segment which has maximum length.
2-If there is still a tie, then return the segment with minimum starting index.
#include<iostream>
using namespace std;
int main(){
int a[10][10],b[10][10],mul[10][10],i,j,k,l,r,c;
cout<<"enter row size\n";
cin>>r;
cout<<"row: "<<r<<endl;
cout<<"enter column size\n";
cin>>c;
cout<<"column: "<<c<<endl;