Skip to content

Instantly share code, notes, and snippets.

@svaza
svaza / ZenMoreSuggestedFeatures.txt
Created October 27, 2019 13:10
Feature Request for Zen app
Intent - Although existing zen mode works good. 1hr of max zen time does no good and extending zen mode to higher time interval will just lock user out from using the device which is against the whole purpose of mobile usage. So instead of treating the mobile as addiction for users, lets make it as a weapon to crub procastination. Zen mode does not mean keeping phone down, mobile can be used in most productive way too. For example a user might ought to read ebooks from Amazon kindle app during 9-10pm everyday and between that time they need no disturbance. Reading news in morning via google news/any other news app in morning.
This by allowing users to access specific user defined apps in zen mode. So kindof making the zen environment where user controls which app should they able to access for zen period
Feature - Zen mode with profiles aka Zen garden or Zen environment
Description -
- Users should be able to define the duration of custom zen period. Which can be max upto 1week
- Users should be able to ad
@svaza
svaza / Solution.cs
Created January 12, 2022 03:48
combination sum
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
public class Solution
{
public class ListBak
{
@svaza
svaza / Program.cs
Created January 13, 2022 11:13
3 sum - 1
using System;
using System.Collections.Generic;
public class Program {
public class ListArrayComparer: IComparer<int[]>
{
public int Compare(int[] a, int[] b)
{
if(a[0] < b[0])
@svaza
svaza / Program.cs
Created January 15, 2022 02:39
Spiral TRaverse
using System;
using System.Collections.Generic;
public class Program {
public static List<int> SpiralTraverse(int[,] array) {
var traverseList = new List<int>();
int rowCounter = 0;
int ColumnCounter = 0;
@svaza
svaza / Program.cs
Created January 15, 2022 20:29
Array of Products
using System;
public class Program {
public int[] ArrayOfProducts(int[] array) {
int allProduct = 1;
int zeroCounter = 0;
int[] productArray = new int[array.Length];
@svaza
svaza / Program.cs
Created January 18, 2022 04:28
Binary tree diameter
using System;
using System.Collections.Generic;
public class Program {
public int BinaryTreeDiameter(BinaryTree tree) {
List<BinaryTree> queue = new List<BinaryTree>();
queue.Add(tree);
int index = 0;
int longestDiameter = -1;
@svaza
svaza / Solution.cs
Created January 23, 2022 20:52
Counting Bits
public class Solution {
public int[] CountBits(int n) {
if(n == 0) return new int[]{ 0 };
int[] output = new int[n + 1];
output[0] = 0;
output[1] = 1;
for(int i = 2; i < output.Length; i++)
{
@svaza
svaza / Solution.cs
Created January 25, 2022 02:53
Divisor Game
// https://leetcode.com/problems/divisor-game/
public class Solution {
public enum Player { Alice = 1, Bob= 2 }
private const int X = 1;
public bool DivisorGame(int n) {
return WhoLooses(Player.Alice, n) != Player.Alice;
}
@svaza
svaza / Solution.cs
Last active January 26, 2022 03:19
pascal triangle
// https://leetcode.com/problems/pascals-triangle/submissions/
public class Solution {
public IList<IList<int>> Generate(int numRows) {
return PascalTriangle(numRows - 1,numRows - 1).Cast<IList<int>>().ToList();
}
public List<List<int>> PascalTriangle(int row, int columns)
{
if(row == 0)
@svaza
svaza / Solution.cs
Created January 26, 2022 03:52
Pascal Triangle 2
// https://leetcode.com/problems/pascals-triangle-ii/
public class Solution {
public IList<int> GetRow(int rowIndex) {
return PascalTriangle2(rowIndex);
}
public List<int> PascalTriangle2(int row)
{
if(row == 0)
return new List<int>() { 1 };