Skip to content

Instantly share code, notes, and snippets.

@Shivani13121007
Shivani13121007 / Longest Substring Without Repeating Characters
Created October 25, 2021 10:38
Longest Substring Without Repeating Characters
class Solution {
public int lengthOfLongestSubstring(String s) {
if(s.length() == 0) return 0;
HashSet<Character> set = new HashSet<>();
int left = 0, right = 0, max = 1;
while(left <= right && right < s.length()) {
if(!set.contains((s.charAt(right)))) {
set.add(s.charAt(right));
max = Math.max(max, right - left + 1);
@Shivani13121007
Shivani13121007 / code.cpp
Created November 20, 2021 09:11
Maximize Sum Of Arr[i]*i Of An Array
#include<bits/stdc++.h>
using namespace std;
int maximise(vector<int>& arr)
{
sort(arr.begin(),arr.end());
int ans = 0;
for(int i=0;i<arr.size();i++)
{
@Shivani13121007
Shivani13121007 / code.java
Created November 20, 2021 09:14
Maximize Sum Of Arr[i]*i Of An Array
import java.util.*;
public class Main {
public static int maximise(int[]arr) {
//write your code here
Arrays.sort(arr);
int ans = 0;
@Shivani13121007
Shivani13121007 / code.java
Created November 20, 2021 09:16
Max Sum In The Configuration
import java.util.*;
public class Main {
public static int maximise(int[]arr) {
//write your code here
int n = arr.length;
int sum = 0;
int S0 = 0;
@Shivani13121007
Shivani13121007 / code.cpp
Created November 20, 2021 09:18
Max Sum In The Configuration
#include<bits/stdc++.h>
using namespace std;
int maximise(vector<int>& arr)
{
int n = arr.size();
int sum = 0;
int S0 = 0;
for(int i=0; i < n;i++) {
@Shivani13121007
Shivani13121007 / code.java
Created November 20, 2021 09:26
Chocolate Distribution
import java.util.*;
import java.io.*;
public class Main {
public static int find(int[]arr, int n, int m) {
Arrays.sort(arr);
int ans = Integer.MAX_VALUE;
for (int i = 0; i <= arr.length - m; i++) {
@Shivani13121007
Shivani13121007 / Main.cpp
Created December 14, 2021 05:21
pepcoding_pattern1
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<=0 || n>26)
@Shivani13121007
Shivani13121007 / Main.cpp
Created December 16, 2021 09:59
Target Index
#include <iostream>
#include<vector>
using namespace std;
int searchInsert(vector<int>& nums, int target)
{
int pivot, left = 0, right = nums.size() - 1;
while (left <= right) {
pivot = left + (right - left) / 2;
@Shivani13121007
Shivani13121007 / solution video
Created January 14, 2022 13:17
In Order Morris Traversal In Binarytree
Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this question we print numbers in Increasing Order and Decreasing Order.
Question Name:
In Order Morris Traversal In Binarytree
Question Link:
https://nados.io/question/in-order-morris-traversal-in-binarytree
@Shivani13121007
Shivani13121007 / Validate Bst
Created January 14, 2022 13:33
Validate Bst
Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this question we print numbers in Increasing Order and Decreasing Order.
Question Name:
Validate Bst
Question Link:
https://nados.io/question/validate-bst