Giter Site home page Giter Site logo

life-coding's Introduction

Life-coding

Solve one problem everyday.

All of my daily problem solving lives in this repo. Some of the wrong attempt is also here. If you follow this repo, make sure you run the code and try with test cases.

Resources

  1. Cracking the coding interview book
  2. https://www.geeksforgeeks.org/
  3. https://www.interviewbit.com/practice/
  4. https://start.interviewing.io/dashboard/interviewee
  5. https://leetcode.com/
  6. https://www.coursera.org/
  7. https://code.google.com/codejam/kickstart/
  8. https://www.pramp.com/dashboard
  9. https://www.youtube.com/channel/UCWSYAntBbdd2SLYUqPIxo0w
  10. https://www.byte-by-byte.com/
  11. https://www.dailycodingproblem.com/
  12. https://coderbyte.com/
  13. https://www.interviewcake.com
  14. https://www.geeksforgeeks.org/must-do-coding-questions-for-companies-like-amazon-microsoft-adobe/
  15. https://www.programcreek.com/2012/11/top-10-algorithms-for-coding-interview/

Helper materials:

Tree:

  1. Segment Tree: https://www.youtube.com/watch?v=Oq2E2yGadnU
  2. AVL Tree: https://www.youtube.com/watch?v=-9sHvAnLN_w

Understanding SSTable

1. https://www.igvita.com/2012/02/06/sstable-and-log-structured-storage-leveldb/
2. https://hackernoon.com/fundamentals-of-system-design-part-3-8da61773a631

Java Code Beauty:

Composition Function: http://www.deadcoderising.com/2015-09-07-java-8-functional-composition-using-compose-and-andthen/

Quick Notes

Counting character frequency in a string.

String s="HelloWorld";
Map<Character, Long> map = t.chars() //converting int stream
                  .mapToObj(c -> (char) c)//int stream to character stream
                  .collect(Collectors.groupingBy(Function.identity(),// collect by group
                          Collectors.counting()));
          System.out.println(map);

Best way to find mid point.

M=start+(end-start)/2;//overflow error free

Sort an int array in descending order

int[] sorted = IntStream.of(inputArray)
        .boxed()
        .sorted(Comparator.reverseOrder())
        .mapToInt(i -> i)
        .toArray();

Iterating over map

map.entrySet().stream().forEach(entry->{
          System.out.println("Key: "+entry.getKey()+"value: "+entry.getValue());
      });

String counting in java 8

        String[] strings=new String[]{"hello","world","hello"};
        List<String> list=Arrays.asList(strings);
        Map<String, Long> map1=         list.stream().collect(groupingBy(identity(), counting()));

Sort list of object based on property

 private static class Inerval {
        int start;
        int end;

        public Inerval(int start, int end) {
            this.start = start;
            this.end = end;
        }
    }
    
     ArrayList<Inerval> list=new ArrayList<>();
     list.add(new Inerval(1,3));
     list.add(new Inerval(5,8));
     list.add(new Inerval(4,10));
     list.add(new Inerval(20,25));
     list.sort(Comparator.comparingInt(v -> v.start));
     list.stream().forEach(interval -> {
                System.out.println(interval.start+"->"+interval.end);
      });

PriorityQueue with custom comparator

 PriorityQueue<ListNode> pq = new PriorityQueue<>(Comparator.comparing(node -> node.val));

life-coding's People

Contributors

nanofaroque avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.