This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static int maximise(int[]arr) { | |
//write your code here | |
Arrays.sort(arr); | |
int ans = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int n; | |
cin>>n; | |
if(n<=0 || n>26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |