How many options do we have to sort a Hashmap in Java 8?

Introduction

  • In this article, we will explore how can we sort HashMap in Java
  • Our Map data structure consists of a news article as value and key as the tag of the article. We would sort the map based on tags.

Java Collections Class

  • Our output would be sorted…


How many options do we have to sort a list in Java 8?

Introduction

  • The list is often a data structure that is used to store java objects and sorting is very common to use cases performed on the list.
  • When we need to sort a list in Java, we often being lazy just do a google search, find the first StackOverflow thread, and copy-paste and customize the code.
  • In this article, I would like to jot down all the possible ways that…


Understanding Problem

input_x = "LVIII"
output_x = 58
L = 50; V=5; III=3
  • There some facts about roman numerals. They are usually written from largest to smallest. In above example L is larger than V.
  • There some instances mentioned below where subtraction is used.
  • I can be placed before (V & X); X can be placed before (L & C); C can be placed before (D & M).
  • So four is not written lie IIII …


Understanding Problem

  • We need to determine if the input string is valid
  • Input string valid only if , open bracket is closed with same type of close bracket and they should be in correct order
  • So we need to return true of parentheses are valid and need to return false if input string is invalid .
"()"   <- valid parentheses
"([]" <- invalid parentheses
"([])" <- valid parentheses

My Thought About Solution


Understanding Problem

input_x    = 121
reversed_x = 121
input_x and reversed_x are palindromic
input_x = -121
reversed_x = 121-
input_x and reversed_x are not palindrominc

My Thought About Solution

  • Then we can compare the input integer and reversed integer and return the result.
  • One additional optimization we can do is that we can return negative integers without even checking if its palindromic or not since…

Understanding Problem

if input_x = 345
return output_x = 543
if input_x = -345
return output_x = -543

My Thought About Solution

  • But we quickly realize that if we do so we also have to handle signs. …

Extract, Transform and Load using Dataflow & BigQuery

Table Of Contents

  • Use Case
  • What are our options?
  • Conclusion

Introduction

In this blog…


Photo by Roman Synkevych on Unsplash

Understanding Problem

Integer[] numbers = {1,2,3,4};
int target = 5
  • our goal is to find the indices of two integers from the given array that adds up to the target,
    so in our example, we have number 2 and 3 that adds up to 5, so our output should result in an array with indices [1,2]
  • One important point to note is that there would be exactly one solution exist. So there won't is more than one solution.
    Additionally…


Ingesting API Data in Google BigQuery the Serverless way!

Introduction

Let's get started.

Design

Cloud Workflow Yaml Configuration


Javascript UDF’s are cool and using with NPM library is a whole new world to explore!

Background

In the era of modern data warehouses like Google BigQuery or SnowFlake, things have changed. These data warehouses can process terabyte and petabyte data within seconds and minutes. Considering this much improvement, now performing data transformation within a data warehouse make more sense. Hence to create common transformation logic via UDF

Suraj Mishra

Backend Engineer by profession. Google Cloud Certified Professional Data Engineer. I share my tech experience on Youtube and Medium.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store