Posted on July 7, 2020 Leave a Comment
Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. For example, given s = “abcba” and k = 2, the longest substring with k distinct characters is “bcb”. Solution Testing
Posted on June 18, 2020 Leave a Comment
This question was asked during an Amazon interview Following schema is provided: Account Total_Salary__c (Number) Max_Salary__c (Number) Account_Salary__c Account__c (lookup) Name (String) Salary__c (Number) An Account can have multiple Account_Salary__c records that lookup to an Account by the Account__c. Write a trigger that would update the Account Total_Salary__c, Max_Salary__c when a new Account salary record […]
Posted on May 18, 2020 Leave a Comment
Remote Process Invocation – Request and Reply Best solutions External Services – invokes a REST API call – allows to invoke externally hosted service in declarative manner. External REST service are available in a an OpenAPI or Integrant schema definition. Contains primitive data types, nested objects not supported. Transaction invoked from Lightning Flow. Integration transaction […]
Posted on April 29, 2020 Leave a Comment
Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer. DecodeHelper class DecodeHelper Test
Posted on September 12, 2019 Leave a Comment
Here it the use case: You have 1 job that you want to run weekly and monthly but the monthly job also has to generate a notification. You don’t need to create two classes but can pass a parameter to the schedule to know it is a weekly or monthly job. The batch Job class […]
Posted on August 5, 2019 Leave a Comment
Here is the problem that needed to be solved: 1. Use session cache to cache some user information like their profile or user settings 2. When a external systems update the information and try to remove the session cache as it got updated it fails because it does not have access to a users session […]
Posted on June 4, 2019 Leave a Comment
Problem: Find the number that has the highest frequency in a list of integers. Input: 1,6,2,1,6,1 Output: 1 //because 1 occurs 3 times in the list Option 1: Use Hashmap to iterate list Option 2: Use wrapper class with compare to sort wrapper Option 3: Using buckets to group index of frequencies together
Posted on May 30, 2019 Leave a Comment
The clearOutRecords would iterate all the fields passed as the currentRecord, then: 1. Exclude the fields as part of the fieldsToExcludeForClearOut Set and relationship fields 2. Check if the field is not null and updateable 3. Special logic to set fields to predefined values 4. Set all other fields to null 5. Return the SObject […]
Posted on May 23, 2019 Leave a Comment
When you need to remove sensitive data from json before logging the following method will remove a predefined list of keywords removeAttributes method will iterate all the keys in the payload and remove the sensitive keys from the payload
Posted on May 20, 2019 Leave a Comment
Here is the problem statement: Given an expectedSum value find the sum (n+ (n+1) = expectedValue) from a list that equals the expectedSum. I am using the following list 1,3,4,4,5,9 and looking for the sum to be 8 (3+5, 4+4) *Note the list is sorted Solution 1: The above time complexity for a nested for […]