{"id":6789,"date":"2025-01-06T08:30:13","date_gmt":"2025-01-06T08:30:13","guid":{"rendered":"https:\/\/algocademy.com\/blog\/how-to-approach-matrix-manipulation-problems-a-comprehensive-guide\/"},"modified":"2025-01-06T08:30:13","modified_gmt":"2025-01-06T08:30:13","slug":"how-to-approach-matrix-manipulation-problems-a-comprehensive-guide","status":"publish","type":"post","link":"https:\/\/algocademy.com\/blog\/how-to-approach-matrix-manipulation-problems-a-comprehensive-guide\/","title":{"rendered":"How to Approach Matrix Manipulation Problems: A Comprehensive Guide"},"content":{"rendered":"<p><!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\"><br \/>\n<html><body><\/p>\n<article>\n<p>Matrix manipulation problems are a common sight in coding interviews, especially for positions at major tech companies like FAANG (Facebook, Amazon, Apple, Netflix, Google). These problems test a candidate&#8217;s ability to work with 2D arrays, understand spatial relationships, and implement efficient algorithms. In this comprehensive guide, we&#8217;ll explore various techniques and strategies to tackle matrix manipulation problems effectively.<\/p>\n<h2>Table of Contents<\/h2>\n<ol>\n<li><a href=\"#understanding-matrices\">Understanding Matrices in Programming<\/a><\/li>\n<li><a href=\"#common-operations\">Common Matrix Operations<\/a><\/li>\n<li><a href=\"#traversal-techniques\">Matrix Traversal Techniques<\/a><\/li>\n<li><a href=\"#in-place-manipulation\">In-place Matrix Manipulation<\/a><\/li>\n<li><a href=\"#search-algorithms\">Search Algorithms for Matrices<\/a><\/li>\n<li><a href=\"#dynamic-programming\">Dynamic Programming on Matrices<\/a><\/li>\n<li><a href=\"#graph-problems\">Graph Problems on Matrices<\/a><\/li>\n<li><a href=\"#optimization-techniques\">Optimization Techniques<\/a><\/li>\n<li><a href=\"#practice-problems\">Practice Problems and Solutions<\/a><\/li>\n<li><a href=\"#interview-tips\">Interview Tips for Matrix Problems<\/a><\/li>\n<\/ol>\n<h2 id=\"understanding-matrices\">1. Understanding Matrices in Programming<\/h2>\n<p>Before diving into matrix manipulation problems, it&#8217;s crucial to have a solid understanding of how matrices are represented in programming languages. In most languages, matrices are implemented as 2D arrays or lists of lists.<\/p>\n<h3>Representation in Different Languages<\/h3>\n<p><strong>Java:<\/strong><\/p>\n<pre><code>int[][] matrix = new int[rows][columns];\n<\/code><\/pre>\n<p><strong>Python:<\/strong><\/p>\n<pre><code>matrix = [[0 for j in range(columns)] for i in range(rows)]\n<\/code><\/pre>\n<p><strong>C++:<\/strong><\/p>\n<pre><code>vector&lt;vector&lt;int&gt;&gt; matrix(rows, vector&lt;int&gt;(columns));\n<\/code><\/pre>\n<h3>Accessing and Modifying Elements<\/h3>\n<p>To access or modify an element in a matrix, you typically use two indices:<\/p>\n<pre><code>\/\/ Accessing an element\nint element = matrix[row][column];\n\n\/\/ Modifying an element\nmatrix[row][column] = newValue;\n<\/code><\/pre>\n<p>Understanding this basic structure is crucial for solving matrix manipulation problems efficiently.<\/p>\n<h2 id=\"common-operations\">2. Common Matrix Operations<\/h2>\n<p>Familiarizing yourself with common matrix operations will give you a solid foundation for tackling more complex problems. Here are some operations you should be comfortable with:<\/p>\n<h3>Matrix Transposition<\/h3>\n<p>Transposing a matrix means switching its rows and columns. Here&#8217;s a simple implementation:<\/p>\n<pre><code>def transpose(matrix):\n    rows, cols = len(matrix), len(matrix[0])\n    transposed = [[0 for _ in range(rows)] for _ in range(cols)]\n    for i in range(rows):\n        for j in range(cols):\n            transposed[j][i] = matrix[i][j]\n    return transposed\n<\/code><\/pre>\n<h3>Matrix Rotation<\/h3>\n<p>Rotating a matrix is a common interview question. Here&#8217;s how to rotate a matrix 90 degrees clockwise:<\/p>\n<pre><code>def rotate90Clockwise(matrix):\n    n = len(matrix)\n    # Transpose the matrix\n    for i in range(n):\n        for j in range(i, n):\n            matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]\n    # Reverse each row\n    for i in range(n):\n        matrix[i].reverse()\n    return matrix\n<\/code><\/pre>\n<h3>Matrix Addition and Multiplication<\/h3>\n<p>While less common in interviews, understanding these operations can be helpful:<\/p>\n<pre><code>def matrix_add(A, B):\n    return [[A[i][j] + B[i][j] for j in range(len(A[0]))] for i in range(len(A))]\n\ndef matrix_multiply(A, B):\n    return [[sum(a*b for a,b in zip(row,col)) for col in zip(*B)] for row in A]\n<\/code><\/pre>\n<h2 id=\"traversal-techniques\">3. Matrix Traversal Techniques<\/h2>\n<p>Efficient traversal of matrices is crucial for many problems. Here are some common traversal patterns:<\/p>\n<h3>Row-wise and Column-wise Traversal<\/h3>\n<pre><code>def row_wise_traversal(matrix):\n    for row in matrix:\n        for element in row:\n            print(element, end=' ')\n        print()\n\ndef column_wise_traversal(matrix):\n    for j in range(len(matrix[0])):\n        for i in range(len(matrix)):\n            print(matrix[i][j], end=' ')\n        print()\n<\/code><\/pre>\n<h3>Diagonal Traversal<\/h3>\n<pre><code>def diagonal_traversal(matrix):\n    rows, cols = len(matrix), len(matrix[0])\n    for d in range(rows + cols - 1):\n        for i in range(max(0, d-cols+1), min(d+1, rows)):\n            j = d - i\n            print(matrix[i][j], end=' ')\n        print()\n<\/code><\/pre>\n<h3>Spiral Traversal<\/h3>\n<p>Spiral traversal is a popular interview question. Here&#8217;s an implementation:<\/p>\n<pre><code>def spiral_traversal(matrix):\n    result = []\n    if not matrix: return result\n    \n    top, bottom = 0, len(matrix) - 1\n    left, right = 0, len(matrix[0]) - 1\n    \n    while top &lt;= bottom and left &lt;= right:\n        # Traverse right\n        for j in range(left, right + 1):\n            result.append(matrix[top][j])\n        top += 1\n        \n        # Traverse down\n        for i in range(top, bottom + 1):\n            result.append(matrix[i][right])\n        right -= 1\n        \n        if top &lt;= bottom:\n            # Traverse left\n            for j in range(right, left - 1, -1):\n                result.append(matrix[bottom][j])\n            bottom -= 1\n        \n        if left &lt;= right:\n            # Traverse up\n            for i in range(bottom, top - 1, -1):\n                result.append(matrix[i][left])\n            left += 1\n    \n    return result\n<\/code><\/pre>\n<h2 id=\"in-place-manipulation\">4. In-place Matrix Manipulation<\/h2>\n<p>In-place manipulation of matrices is an important skill, especially when dealing with space complexity constraints. Here are some techniques:<\/p>\n<h3>Using Extra Variables<\/h3>\n<p>Sometimes, you can use a few extra variables to perform in-place operations. For example, rotating a matrix in-place:<\/p>\n<pre><code>def rotate_in_place(matrix):\n    n = len(matrix)\n    for i in range(n \/\/ 2):\n        for j in range(i, n - i - 1):\n            temp = matrix[i][j]\n            matrix[i][j] = matrix[n-1-j][i]\n            matrix[n-1-j][i] = matrix[n-1-i][n-1-j]\n            matrix[n-1-i][n-1-j] = matrix[j][n-1-i]\n            matrix[j][n-1-i] = temp\n    return matrix\n<\/code><\/pre>\n<h3>Using Bitwise XOR<\/h3>\n<p>For problems involving swapping elements, you can use XOR to swap without using an extra variable:<\/p>\n<pre><code>def swap_without_temp(a, b):\n    a = a ^ b\n    b = a ^ b\n    a = a ^ b\n    return a, b\n<\/code><\/pre>\n<h3>Reversing Rows or Columns<\/h3>\n<p>Many matrix problems can be solved by reversing rows or columns in-place:<\/p>\n<pre><code>def reverse_rows(matrix):\n    for row in matrix:\n        row.reverse()\n    return matrix\n\ndef reverse_columns(matrix):\n    for j in range(len(matrix[0])):\n        i, k = 0, len(matrix) - 1\n        while i &lt; k:\n            matrix[i][j], matrix[k][j] = matrix[k][j], matrix[i][j]\n            i += 1\n            k -= 1\n    return matrix\n<\/code><\/pre>\n<h2 id=\"search-algorithms\">5. Search Algorithms for Matrices<\/h2>\n<p>Efficient search algorithms are crucial for many matrix problems. Here are some common search techniques:<\/p>\n<h3>Binary Search on Sorted Matrix<\/h3>\n<p>If a matrix is sorted (either row-wise or column-wise), you can use binary search:<\/p>\n<pre><code>def search_sorted_matrix(matrix, target):\n    if not matrix or not matrix[0]:\n        return False\n    \n    rows, cols = len(matrix), len(matrix[0])\n    left, right = 0, rows * cols - 1\n    \n    while left &lt;= right:\n        mid = (left + right) \/\/ 2\n        mid_value = matrix[mid \/\/ cols][mid % cols]\n        \n        if mid_value == target:\n            return True\n        elif mid_value &lt; target:\n            left = mid + 1\n        else:\n            right = mid - 1\n    \n    return False\n<\/code><\/pre>\n<h3>Search in Row-wise and Column-wise Sorted Matrix<\/h3>\n<p>For matrices sorted both row-wise and column-wise, you can use this efficient search method:<\/p>\n<pre><code>def search_row_col_sorted(matrix, target):\n    if not matrix or not matrix[0]:\n        return False\n    \n    rows, cols = len(matrix), len(matrix[0])\n    row, col = 0, cols - 1\n    \n    while row &lt; rows and col &gt;= 0:\n        if matrix[row][col] == target:\n            return True\n        elif matrix[row][col] &gt; target:\n            col -= 1\n        else:\n            row += 1\n    \n    return False\n<\/code><\/pre>\n<h2 id=\"dynamic-programming\">6. Dynamic Programming on Matrices<\/h2>\n<p>Dynamic Programming (DP) is a powerful technique for solving optimization problems on matrices. Here are some common DP patterns for matrix problems:<\/p>\n<h3>2D DP Table<\/h3>\n<p>Many matrix DP problems involve creating a 2D DP table. Here&#8217;s an example of finding the maximum square submatrix of 1s:<\/p>\n<pre><code>def max_square_submatrix(matrix):\n    if not matrix or not matrix[0]:\n        return 0\n    \n    rows, cols = len(matrix), len(matrix[0])\n    dp = [[0] * (cols + 1) for _ in range(rows + 1)]\n    max_side = 0\n    \n    for i in range(1, rows + 1):\n        for j in range(1, cols + 1):\n            if matrix[i-1][j-1] == 1:\n                dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1\n                max_side = max(max_side, dp[i][j])\n    \n    return max_side * max_side\n<\/code><\/pre>\n<h3>Prefix Sum Matrix<\/h3>\n<p>Prefix sum matrices are useful for quickly calculating the sum of any rectangular submatrix:<\/p>\n<pre><code>def create_prefix_sum_matrix(matrix):\n    rows, cols = len(matrix), len(matrix[0])\n    prefix_sum = [[0] * (cols + 1) for _ in range(rows + 1)]\n    \n    for i in range(1, rows + 1):\n        for j in range(1, cols + 1):\n            prefix_sum[i][j] = (prefix_sum[i-1][j] + prefix_sum[i][j-1] \n                                - prefix_sum[i-1][j-1] + matrix[i-1][j-1])\n    \n    return prefix_sum\n\ndef sum_region(prefix_sum, row1, col1, row2, col2):\n    return (prefix_sum[row2+1][col2+1] - prefix_sum[row1][col2+1] \n            - prefix_sum[row2+1][col1] + prefix_sum[row1][col1])\n<\/code><\/pre>\n<h2 id=\"graph-problems\">7. Graph Problems on Matrices<\/h2>\n<p>Many graph problems can be represented and solved using matrices. Here are some common patterns:<\/p>\n<h3>DFS on Matrix<\/h3>\n<p>Depth-First Search (DFS) can be used to solve problems like finding connected components or paths in a matrix:<\/p>\n<pre><code>def dfs_matrix(matrix, i, j, visited):\n    if (i &lt; 0 or i &gt;= len(matrix) or \n        j &lt; 0 or j &gt;= len(matrix[0]) or \n        visited[i][j] or matrix[i][j] == 0):\n        return\n    \n    visited[i][j] = True\n    \n    # Visit all 4 adjacent cells\n    directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n    for di, dj in directions:\n        dfs_matrix(matrix, i + di, j + dj, visited)\n\ndef find_connected_components(matrix):\n    if not matrix or not matrix[0]:\n        return 0\n    \n    rows, cols = len(matrix), len(matrix[0])\n    visited = [[False] * cols for _ in range(rows)]\n    count = 0\n    \n    for i in range(rows):\n        for j in range(cols):\n            if matrix[i][j] == 1 and not visited[i][j]:\n                dfs_matrix(matrix, i, j, visited)\n                count += 1\n    \n    return count\n<\/code><\/pre>\n<h3>BFS on Matrix<\/h3>\n<p>Breadth-First Search (BFS) is useful for problems involving shortest paths or level-order traversals:<\/p>\n<pre><code>from collections import deque\n\ndef bfs_matrix(matrix, start_i, start_j):\n    rows, cols = len(matrix), len(matrix[0])\n    visited = [[False] * cols for _ in range(rows)]\n    queue = deque([(start_i, start_j)])\n    visited[start_i][start_j] = True\n    \n    directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n    \n    while queue:\n        i, j = queue.popleft()\n        print(f\"Visited: ({i}, {j})\")\n        \n        for di, dj in directions:\n            ni, nj = i + di, j + dj\n            if (0 &lt;= ni &lt; rows and 0 &lt;= nj &lt; cols and \n                not visited[ni][nj] and matrix[ni][nj] == 1):\n                queue.append((ni, nj))\n                visited[ni][nj] = True\n\n# Example usage\nmatrix = [\n    [1, 0, 1, 1],\n    [1, 1, 1, 0],\n    [0, 1, 0, 1],\n    [1, 1, 1, 1]\n]\nbfs_matrix(matrix, 0, 0)\n<\/code><\/pre>\n<h2 id=\"optimization-techniques\">8. Optimization Techniques<\/h2>\n<p>When working with large matrices, optimization becomes crucial. Here are some techniques to improve the efficiency of your matrix algorithms:<\/p>\n<h3>Space Optimization<\/h3>\n<p>Sometimes, you can reduce the space complexity by using only a single row or column instead of the entire matrix. For example, in the problem of finding the maximum sum submatrix, you can optimize space like this:<\/p>\n<pre><code>def max_sum_submatrix(matrix):\n    if not matrix or not matrix[0]:\n        return 0\n    \n    rows, cols = len(matrix), len(matrix[0])\n    max_sum = float('-inf')\n    \n    for left in range(cols):\n        temp = [0] * rows\n        for right in range(left, cols):\n            for i in range(rows):\n                temp[i] += matrix[i][right]\n            \n            current_sum = kadane(temp)\n            max_sum = max(max_sum, current_sum)\n    \n    return max_sum\n\ndef kadane(arr):\n    max_sum = current_sum = arr[0]\n    for num in arr[1:]:\n        current_sum = max(num, current_sum + num)\n        max_sum = max(max_sum, current_sum)\n    return max_sum\n<\/code><\/pre>\n<h3>Bit Manipulation<\/h3>\n<p>For certain problems, especially those involving binary matrices, bit manipulation can lead to significant optimizations:<\/p>\n<pre><code>def count_submatrices_all_ones(matrix):\n    if not matrix or not matrix[0]:\n        return 0\n    \n    rows, cols = len(matrix), len(matrix[0])\n    result = 0\n    \n    for i in range(rows):\n        row_mask = (1 &lt;&lt; cols) - 1\n        for j in range(i, rows):\n            row_mask &amp;= int(''.join(map(str, matrix[j])), 2)\n            result += bin(row_mask).count('1')\n    \n    return result\n<\/code><\/pre>\n<h3>Matrix Compression<\/h3>\n<p>For sparse matrices, you can use compression techniques to save space and improve performance:<\/p>\n<pre><code>class SparseMatrix:\n    def __init__(self, matrix):\n        self.sparse = {}\n        for i in range(len(matrix)):\n            for j in range(len(matrix[0])):\n                if matrix[i][j] != 0:\n                    self.sparse[(i, j)] = matrix[i][j]\n    \n    def get(self, i, j):\n        return self.sparse.get((i, j), 0)\n    \n    def set(self, i, j, value):\n        if value != 0:\n            self.sparse[(i, j)] = value\n        elif (i, j) in self.sparse:\n            del self.sparse[(i, j)]\n\n# Example usage\nmatrix = [\n    [0, 0, 3, 0],\n    [0, 2, 0, 0],\n    [1, 0, 0, 4]\n]\nsparse_matrix = SparseMatrix(matrix)\nprint(sparse_matrix.get(0, 2))  # Output: 3\nprint(sparse_matrix.get(1, 1))  # Output: 2\nsparse_matrix.set(1, 1, 0)\nprint(sparse_matrix.get(1, 1))  # Output: 0\n<\/code><\/pre>\n<h2 id=\"practice-problems\">9. Practice Problems and Solutions<\/h2>\n<p>To solidify your understanding of matrix manipulation, here are some practice problems with brief solutions:<\/p>\n<h3>Problem 1: Island Perimeter<\/h3>\n<p>Given a 2D grid map of 1s (land) and 0s (water), count the perimeter of the island.<\/p>\n<pre><code>def island_perimeter(grid):\n    perimeter = 0\n    rows, cols = len(grid), len(grid[0])\n    \n    for i in range(rows):\n        for j in range(cols):\n            if grid[i][j] == 1:\n                perimeter += 4\n                if i &gt; 0 and grid[i-1][j] == 1:\n                    perimeter -= 2\n                if j &gt; 0 and grid[i][j-1] == 1:\n                    perimeter -= 2\n    \n    return perimeter\n<\/code><\/pre>\n<h3>Problem 2: Set Matrix Zeroes<\/h3>\n<p>Given a matrix, if an element is 0, set its entire row and column to 0. Do it in-place.<\/p>\n<pre><code>def set_zeroes(matrix):\n    rows, cols = len(matrix), len(matrix[0])\n    first_row_zero = False\n    first_col_zero = False\n    \n    # Check if first row contains zero\n    for j in range(cols):\n        if matrix[0][j] == 0:\n            first_row_zero = True\n            break\n    \n    # Check if first column contains zero\n    for i in range(rows):\n        if matrix[i][0] == 0:\n            first_col_zero = True\n            break\n    \n    # Use first row and column as markers\n    for i in range(1, rows):\n        for j in range(1, cols):\n            if matrix[i][j] == 0:\n                matrix[i][0] = 0\n                matrix[0][j] = 0\n    \n    # Set zeros based on markers\n    for i in range(1, rows):\n        for j in range(1, cols):\n            if matrix[i][0] == 0 or matrix[0][j] == 0:\n                matrix[i][j] = 0\n    \n    # Set first row to zero if needed\n    if first_row_zero:\n        for j in range(cols):\n            matrix[0][j] = 0\n    \n    # Set first column to zero if needed\n    if first_col_zero:\n        for i in range(rows):\n            matrix[i][0] = 0\n<\/code><\/pre>\n<h3>Problem 3: Longest Increasing Path in a Matrix<\/h3>\n<p>Given an integer matrix, find the length of the longest increasing path.<\/p>\n<pre><code>def longest_increasing_path(matrix):\n    if not matrix or not matrix[0]:\n        return 0\n    \n    rows, cols = len(matrix), len(matrix[0])\n    dp = [[0] * cols for _ in range(rows)]\n    \n    def dfs(i, j):\n        if dp[i][j] != 0:\n            return dp[i][j]\n        \n        directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n        max_length = 1\n        \n        for di, dj in directions:\n            ni, nj = i + di, j + dj\n            if (0 &lt;= ni &lt; rows and 0 &lt;= nj &lt; cols and \n                matrix[ni][nj] &gt; matrix[i][j]):\n                max_length = max(max_length, 1 + dfs(ni, nj))\n        \n        dp[i][j] = max_length\n        return max_length\n    \n    return max(dfs(i, j) for i in range(rows) for j in range(cols))\n<\/code><\/pre>\n<h2 id=\"interview-tips\">10. Interview Tips for Matrix Problems<\/h2>\n<p>When tackling matrix problems in interviews, keep these tips in mind:<\/p>\n<ol>\n<li><strong>Clarify the Input:<\/strong> Always ask about the dimensions of the matrix and any constraints on the values.<\/li>\n<li><strong>Consider Edge Cases:<\/strong> Think about empty matrices, single-row or single-column matrices, and matrices with all identical elements.<\/li>\n<li><strong>Visualize the Problem:<\/strong> Draw out small examples to help understand the problem and explain your approach.<\/li>\n<li><strong>Start Simple:<\/strong> Begin with a brute-force solution, then optimize. It&#8217;s better to have a working solution than no solution at all.<\/li>\n<li><strong>Think About Space Complexity:<\/strong> If asked to solve in-place, consider using the input matrix itself for storage.<\/li>\n<li><strong>Use Standard Techniques:<\/strong> Many matrix problems can be solved using DFS, BFS, DP, or two-pointer techniques.<\/li>\n<li><strong>Practice Common Patterns:<\/strong> Familiarize yourself with spiral traversal, diagonal traversal, and matrix rotation.<\/li>\n<li><strong>Optimize Incrementally:<\/strong> If your initial solution is not optimal, explain how you would improve it step by step.<\/li>\n<li><strong>Test Your Solution:<\/strong> Before declaring you&#8217;re done, mentally walk through your code with a small example.<\/li>\n<li><strong>Communicate Clearly:<\/strong> Explain your thought process, including why you chose certain approaches over others.<\/li>\n<\/ol>\n<p>By mastering these techniques and practicing regularly, you&#8217;ll be well-prepared to tackle matrix manipulation problems in coding interviews. Remember, the key is not just to solve the problem, but to demonstrate your problem-solving process and ability to optimize solutions.<\/p>\n<\/article>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Matrix manipulation problems are a common sight in coding interviews, especially for positions at major tech companies like FAANG (Facebook,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6788,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-6789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-problem-solving"],"_links":{"self":[{"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/posts\/6789"}],"collection":[{"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/comments?post=6789"}],"version-history":[{"count":0,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/posts\/6789\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/media\/6788"}],"wp:attachment":[{"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/media?parent=6789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/categories?post=6789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algocademy.com\/blog\/wp-json\/wp\/v2\/tags?post=6789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}